1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_BROWSER_TABS_PINNED_TAB_SERVICE_H_ 6 #define CHROME_BROWSER_TABS_PINNED_TAB_SERVICE_H_ 7 #pragma once 8 9 #include "chrome/browser/profiles/profile_keyed_service.h" 10 #include "content/common/notification_observer.h" 11 #include "content/common/notification_registrar.h" 12 13 class Profile; 14 15 // PinnedTabService is responsible for updating preferences with the set of 16 // pinned tabs to restore at startup. PinnedTabService listens for the 17 // appropriate set of notifications to know it should update preferences. 18 class PinnedTabService : public NotificationObserver, 19 public ProfileKeyedService { 20 public: 21 explicit PinnedTabService(Profile* profile); 22 23 private: 24 // Invoked when we're about to exit. 25 void GotExit(); 26 27 // NotificationObserver. 28 virtual void Observe(NotificationType type, 29 const NotificationSource& source, 30 const NotificationDetails& details); 31 32 Profile* profile_; 33 34 // If true we've seen an exit event (or the last browser is closing which 35 // triggers an exit) and can ignore all other events. 36 bool got_exiting_; 37 38 // True if there is at least one normal browser for our profile. 39 bool has_normal_browser_; 40 41 NotificationRegistrar registrar_; 42 43 DISALLOW_COPY_AND_ASSIGN(PinnedTabService); 44 }; 45 46 #endif // CHROME_BROWSER_TABS_PINNED_TAB_SERVICE_H_ 47