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" | 9 #include "chrome/browser/api/sync/profile_sync_service_observer.h" |
10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 int GetLastBlockedCommand(WindowOpenDisposition* disposition); | 59 int GetLastBlockedCommand(WindowOpenDisposition* disposition); |
60 | 60 |
61 // Notifies the controller that state has changed in one of the following | 61 // Notifies the controller that state has changed in one of the following |
62 // areas and it should update command states. | 62 // areas and it should update command states. |
63 void TabStateChanged(); | 63 void TabStateChanged(); |
64 void ContentRestrictionsChanged(); | 64 void ContentRestrictionsChanged(); |
65 void FullscreenStateChanged(); | 65 void FullscreenStateChanged(); |
66 void PrintingStateChanged(); | 66 void PrintingStateChanged(); |
67 void LoadingStateChanged(bool is_loading, bool force); | 67 void LoadingStateChanged(bool is_loading, bool force); |
68 | 68 |
| 69 // Shared state updating: these functions are static and public to share with |
| 70 // outside code. |
| 71 |
| 72 // Updates the open-file state. |
| 73 static void UpdateOpenFileState(CommandUpdater* command_updater); |
| 74 |
| 75 // Update commands whose state depends on incognito mode availability and that |
| 76 // only depend on the profile. |
| 77 static void UpdateSharedCommandsForIncognitoAvailability( |
| 78 CommandUpdater* command_updater, |
| 79 Profile* profile); |
| 80 |
69 private: | 81 private: |
70 enum FullScreenMode { | 82 enum FullScreenMode { |
71 // Not in fullscreen mode. | 83 // Not in fullscreen mode. |
72 FULLSCREEN_DISABLED, | 84 FULLSCREEN_DISABLED, |
73 | 85 |
74 // Fullscreen mode, occupying the whole screen. | 86 // Fullscreen mode, occupying the whole screen. |
75 FULLSCREEN_NORMAL, | 87 FULLSCREEN_NORMAL, |
76 | 88 |
77 // Fullscreen mode for metro snap, occupying the full height and 20% of | 89 // Fullscreen mode for metro snap, occupying the full height and 20% of |
78 // the screen width. | 90 // the screen width. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Update commands whose state depends on whether multiple profiles are | 168 // Update commands whose state depends on whether multiple profiles are |
157 // allowed. | 169 // allowed. |
158 void UpdateCommandsForMultipleProfiles(); | 170 void UpdateCommandsForMultipleProfiles(); |
159 | 171 |
160 // Updates the printing command state. | 172 // Updates the printing command state. |
161 void UpdatePrintingState(); | 173 void UpdatePrintingState(); |
162 | 174 |
163 // Updates the save-page-as command state. | 175 // Updates the save-page-as command state. |
164 void UpdateSaveAsState(); | 176 void UpdateSaveAsState(); |
165 | 177 |
166 // Updates the open-file state (Mac Only). | |
167 void UpdateOpenFileState(); | |
168 | |
169 // Ask the Reload/Stop button to change its icon, and update the Stop command | 178 // Ask the Reload/Stop button to change its icon, and update the Stop command |
170 // state. |is_loading| is true if the current WebContents is loading. | 179 // state. |is_loading| is true if the current WebContents is loading. |
171 // |force| is true if the button should change its icon immediately. | 180 // |force| is true if the button should change its icon immediately. |
172 void UpdateReloadStopState(bool is_loading, bool force); | 181 void UpdateReloadStopState(bool is_loading, bool force); |
173 | 182 |
174 // Updates commands for find. | 183 // Updates commands for find. |
175 void UpdateCommandsForFind(); | 184 void UpdateCommandsForFind(); |
176 | 185 |
177 // Add/remove observers for interstitial attachment/detachment from | 186 // Add/remove observers for interstitial attachment/detachment from |
178 // |contents|. | 187 // |contents|. |
(...skipping 22 matching lines...) Expand all Loading... |
201 content::NotificationRegistrar registrar_; | 210 content::NotificationRegistrar registrar_; |
202 PrefChangeRegistrar profile_pref_registrar_; | 211 PrefChangeRegistrar profile_pref_registrar_; |
203 PrefChangeRegistrar local_pref_registrar_; | 212 PrefChangeRegistrar local_pref_registrar_; |
204 | 213 |
205 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); | 214 DISALLOW_COPY_AND_ASSIGN(BrowserCommandController); |
206 }; | 215 }; |
207 | 216 |
208 } // namespace chrome | 217 } // namespace chrome |
209 | 218 |
210 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ | 219 #endif // CHROME_BROWSER_UI_BROWSER_COMMAND_CONTROLLER_H_ |
OLD | NEW |