| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_TABS_PINNED_TAB_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_H_ |
| 6 #define CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_H_ | 6 #define CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/ui/browser_list_observer.h" |
| 10 #include "components/keyed_service/core/keyed_service.h" | 11 #include "components/keyed_service/core/keyed_service.h" |
| 11 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
| 12 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
| 13 | 14 |
| 14 class Profile; | 15 class Profile; |
| 15 | 16 |
| 16 // PinnedTabService is responsible for updating preferences with the set of | 17 // PinnedTabService is responsible for updating preferences with the set of |
| 17 // pinned tabs to restore at startup. PinnedTabService listens for the | 18 // pinned tabs to restore at startup. PinnedTabService listens for the |
| 18 // appropriate set of notifications to know it should update preferences. | 19 // appropriate set of notifications to know it should update preferences. |
| 19 class PinnedTabService : public content::NotificationObserver, | 20 class PinnedTabService : public content::NotificationObserver, |
| 21 public chrome::BrowserListObserver, |
| 20 public KeyedService { | 22 public KeyedService { |
| 21 public: | 23 public: |
| 22 explicit PinnedTabService(Profile* profile); | 24 explicit PinnedTabService(Profile* profile); |
| 23 | 25 |
| 24 private: | 26 private: |
| 25 // content::NotificationObserver. | 27 // content::NotificationObserver. |
| 26 void Observe(int type, | 28 void Observe(int type, |
| 27 const content::NotificationSource& source, | 29 const content::NotificationSource& source, |
| 28 const content::NotificationDetails& details) override; | 30 const content::NotificationDetails& details) override; |
| 29 | 31 |
| 32 // chrome::BrowserListObserver: |
| 33 void OnBrowserCloseStarted(Browser* browser) override; |
| 34 |
| 30 Profile* profile_; | 35 Profile* profile_; |
| 31 | 36 |
| 32 // True if we should save the pinned tabs when a browser window closes or the | 37 // True if we should save the pinned tabs when a browser window closes or the |
| 33 // user exits the application. | 38 // user exits the application. |
| 34 bool save_pinned_tabs_; | 39 bool save_pinned_tabs_; |
| 35 | 40 |
| 36 // True if there is at least one normal browser for our profile. | 41 // True if there is at least one normal browser for our profile. |
| 37 bool has_normal_browser_; | 42 bool has_normal_browser_; |
| 38 | 43 |
| 39 content::NotificationRegistrar registrar_; | 44 content::NotificationRegistrar registrar_; |
| 40 | 45 |
| 41 DISALLOW_COPY_AND_ASSIGN(PinnedTabService); | 46 DISALLOW_COPY_AND_ASSIGN(PinnedTabService); |
| 42 }; | 47 }; |
| 43 | 48 |
| 44 #endif // CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_H_ | 49 #endif // CHROME_BROWSER_UI_TABS_PINNED_TAB_SERVICE_H_ |
| OLD | NEW |