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