| 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_BROWSER_COMMAND_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/prefs/public/pref_change_registrar.h" | 8 #include "base/prefs/public/pref_change_registrar.h" |
| 9 #include "chrome/browser/api/sync/profile_sync_service_observer.h" | |
| 10 #include "chrome/browser/command_updater.h" | 9 #include "chrome/browser/command_updater.h" |
| 11 #include "chrome/browser/command_updater_delegate.h" | 10 #include "chrome/browser/command_updater_delegate.h" |
| 12 #include "chrome/browser/profiles/profile_info_cache_observer.h" | 11 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 13 #include "chrome/browser/sessions/tab_restore_service_observer.h" | 12 #include "chrome/browser/sessions/tab_restore_service_observer.h" |
| 13 #include "chrome/browser/signin/signin_pref_observer.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 15 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 16 #include "content/public/browser/notification_registrar.h" | 16 #include "content/public/browser/notification_registrar.h" |
| 17 #include "ui/base/window_open_disposition.h" | 17 #include "ui/base/window_open_disposition.h" |
| 18 | 18 |
| 19 class Browser; | 19 class Browser; |
| 20 class BrowserWindow; | 20 class BrowserWindow; |
| 21 class Profile; | 21 class Profile; |
| 22 class ProfileManager; | 22 class ProfileManager; |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 struct NativeWebKeyboardEvent; | 25 struct NativeWebKeyboardEvent; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace chrome { | 28 namespace chrome { |
| 29 | 29 |
| 30 class BrowserCommandController : public CommandUpdaterDelegate, | 30 class BrowserCommandController : public CommandUpdaterDelegate, |
| 31 public content::NotificationObserver, | 31 public content::NotificationObserver, |
| 32 public ProfileInfoCacheObserver, | 32 public ProfileInfoCacheObserver, |
| 33 public SigninPrefObserver, |
| 33 public TabStripModelObserver, | 34 public TabStripModelObserver, |
| 34 public TabRestoreServiceObserver { | 35 public TabRestoreServiceObserver { |
| 35 public: | 36 public: |
| 36 BrowserCommandController(Browser* browser, ProfileManager* profile_manager); | 37 BrowserCommandController(Browser* browser, ProfileManager* profile_manager); |
| 37 virtual ~BrowserCommandController(); | 38 virtual ~BrowserCommandController(); |
| 38 | 39 |
| 39 CommandUpdater* command_updater() { return &command_updater_; } | 40 CommandUpdater* command_updater() { return &command_updater_; } |
| 40 bool block_command_execution() const { return block_command_execution_; } | 41 bool block_command_execution() const { return block_command_execution_; } |
| 41 | 42 |
| 42 // Returns true if |command_id| is a reserved command whose keyboard shortcuts | 43 // Returns true if |command_id| is a reserved command whose keyboard shortcuts |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 content::WebContents* old_contents, | 121 content::WebContents* old_contents, |
| 121 content::WebContents* new_contents, | 122 content::WebContents* new_contents, |
| 122 int index) OVERRIDE; | 123 int index) OVERRIDE; |
| 123 virtual void TabBlockedStateChanged(content::WebContents* contents, | 124 virtual void TabBlockedStateChanged(content::WebContents* contents, |
| 124 int index) OVERRIDE; | 125 int index) OVERRIDE; |
| 125 | 126 |
| 126 // Overridden from TabRestoreServiceObserver: | 127 // Overridden from TabRestoreServiceObserver: |
| 127 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; | 128 virtual void TabRestoreServiceChanged(TabRestoreService* service) OVERRIDE; |
| 128 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; | 129 virtual void TabRestoreServiceDestroyed(TabRestoreService* service) OVERRIDE; |
| 129 | 130 |
| 131 // Overridden from SigninPrefObserver: |
| 132 virtual void OnSigninAllowedPrefChange(bool signin_allowed) OVERRIDE; |
| 133 |
| 130 // Returns true if the regular Chrome UI (not the fullscreen one and | 134 // Returns true if the regular Chrome UI (not the fullscreen one and |
| 131 // not the single-tab one) is shown. Used for updating window command states | 135 // not the single-tab one) is shown. Used for updating window command states |
| 132 // only. Consider using SupportsWindowFeature if you need the mentioned | 136 // only. Consider using SupportsWindowFeature if you need the mentioned |
| 133 // functionality anywhere else. | 137 // functionality anywhere else. |
| 134 bool IsShowingMainUI(bool is_fullscreen); | 138 bool IsShowingMainUI(bool is_fullscreen); |
| 135 | 139 |
| 136 // Initialize state for all browser commands. | 140 // Initialize state for all browser commands. |
| 137 void InitCommandState(); | 141 void InitCommandState(); |
| 138 | 142 |
| 139 // Update commands whose state depends on incognito mode availability. | 143 // Update commands whose state depends on incognito mode availability. |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 content::NotificationRegistrar registrar_; | 211 content::NotificationRegistrar registrar_; |
| 208 PrefChangeRegistrar profile_pref_registrar_; | 212 PrefChangeRegistrar profile_pref_registrar_; |
| 209 PrefChangeRegistrar local_pref_registrar_; | 213 PrefChangeRegistrar local_pref_registrar_; |
| 210 | 214 |
| 211 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); | 215 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); |
| 212 }; | 216 }; |
| 213 | 217 |
| 214 } // namespace chrome | 218 } // namespace chrome |
| 215 | 219 |
| 216 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 220 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
| OLD | NEW |