OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/browser.h" | 5 #include "chrome/browser/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 1073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1084 command_updater_.UpdateCommandEnabled( | 1084 command_updater_.UpdateCommandEnabled( |
1085 IDC_FOCUS_PREVIOUS_PANE, main_not_fullscreen_or_popup); | 1085 IDC_FOCUS_PREVIOUS_PANE, main_not_fullscreen_or_popup); |
1086 command_updater_.UpdateCommandEnabled( | 1086 command_updater_.UpdateCommandEnabled( |
1087 IDC_FOCUS_BOOKMARKS, main_not_fullscreen_or_popup); | 1087 IDC_FOCUS_BOOKMARKS, main_not_fullscreen_or_popup); |
1088 command_updater_.UpdateCommandEnabled( | 1088 command_updater_.UpdateCommandEnabled( |
1089 IDC_FOCUS_CHROMEOS_STATUS, main_not_fullscreen_or_popup); | 1089 IDC_FOCUS_CHROMEOS_STATUS, main_not_fullscreen_or_popup); |
1090 | 1090 |
1091 // Show various bits of UI | 1091 // Show various bits of UI |
1092 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui); | 1092 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui); |
1093 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); | 1093 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); |
1094 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); | 1094 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, |
| 1095 browser_defaults::bookmarks_enabled && show_main_ui); |
1095 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); | 1096 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); |
1096 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, | 1097 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, |
1097 show_main_ui && profile_->IsSyncAccessible()); | 1098 show_main_ui && profile_->IsSyncAccessible()); |
1098 | 1099 |
1099 #if defined(ENABLE_REMOTING) | 1100 #if defined(ENABLE_REMOTING) |
1100 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) { | 1101 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) { |
1101 command_updater_.UpdateCommandEnabled(IDC_REMOTING_SETUP, show_main_ui); | 1102 command_updater_.UpdateCommandEnabled(IDC_REMOTING_SETUP, show_main_ui); |
1102 } | 1103 } |
1103 #endif | 1104 #endif |
1104 | 1105 |
(...skipping 2134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3239 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); | 3240 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); |
3240 | 3241 |
3241 // Show various bits of UI | 3242 // Show various bits of UI |
3242 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true); | 3243 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true); |
3243 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); | 3244 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); |
3244 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS, true); | 3245 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS, true); |
3245 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_CONSOLE, true); | 3246 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_CONSOLE, true); |
3246 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_INSPECT, true); | 3247 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_INSPECT, true); |
3247 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); | 3248 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); |
3248 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); | 3249 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); |
3249 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); | 3250 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, |
| 3251 browser_defaults::bookmarks_enabled); |
3250 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 3252 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
3251 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); | 3253 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); |
3252 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); | 3254 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); |
3253 | 3255 |
3254 #if defined(OS_CHROMEOS) | 3256 #if defined(OS_CHROMEOS) |
3255 command_updater_.UpdateCommandEnabled(IDC_SEARCH, true); | 3257 command_updater_.UpdateCommandEnabled(IDC_SEARCH, true); |
3256 command_updater_.UpdateCommandEnabled(IDC_SYSTEM_OPTIONS, true); | 3258 command_updater_.UpdateCommandEnabled(IDC_SYSTEM_OPTIONS, true); |
3257 command_updater_.UpdateCommandEnabled(IDC_INTERNET_OPTIONS, true); | 3259 command_updater_.UpdateCommandEnabled(IDC_INTERNET_OPTIONS, true); |
3258 #endif | 3260 #endif |
3259 | 3261 |
(...skipping 25 matching lines...) Expand all Loading... |
3285 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); | 3287 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); |
3286 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); | 3288 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); |
3287 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); | 3289 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); |
3288 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); | 3290 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); |
3289 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); | 3291 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); |
3290 #if defined(OS_MACOSX) | 3292 #if defined(OS_MACOSX) |
3291 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window); | 3293 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window); |
3292 #endif | 3294 #endif |
3293 | 3295 |
3294 // Page-related commands | 3296 // Page-related commands |
3295 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, normal_window); | 3297 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, |
| 3298 browser_defaults::bookmarks_enabled && normal_window); |
3296 | 3299 |
3297 // Clipboard commands | 3300 // Clipboard commands |
3298 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, non_devtools_window); | 3301 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, non_devtools_window); |
3299 | 3302 |
3300 // Find-in-page | 3303 // Find-in-page |
3301 command_updater_.UpdateCommandEnabled(IDC_FIND, non_devtools_window); | 3304 command_updater_.UpdateCommandEnabled(IDC_FIND, non_devtools_window); |
3302 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, non_devtools_window); | 3305 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, non_devtools_window); |
3303 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, non_devtools_window); | 3306 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, non_devtools_window); |
3304 | 3307 |
3305 // AutoFill | 3308 // AutoFill |
(...skipping 26 matching lines...) Expand all Loading... |
3332 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, | 3335 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, |
3333 non_app_window && CanDuplicateContentsAt(selected_index())); | 3336 non_app_window && CanDuplicateContentsAt(selected_index())); |
3334 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, | 3337 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, |
3335 non_app_window && tab_count() > 1); | 3338 non_app_window && tab_count() > 1); |
3336 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, | 3339 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, |
3337 non_app_window && tab_count() > 1); | 3340 non_app_window && tab_count() > 1); |
3338 | 3341 |
3339 // Page-related commands | 3342 // Page-related commands |
3340 window_->SetStarredState(current_tab->is_starred()); | 3343 window_->SetStarredState(current_tab->is_starred()); |
3341 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, | 3344 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, |
3342 CanBookmarkAllTabs()); | 3345 browser_defaults::bookmarks_enabled && CanBookmarkAllTabs()); |
3343 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, | 3346 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, |
3344 current_tab->controller().CanViewSource()); | 3347 current_tab->controller().CanViewSource()); |
3345 // Instead of using GetURL here, we use url() (which is the "real" url of the | 3348 // Instead of using GetURL here, we use url() (which is the "real" url of the |
3346 // page) from the NavigationEntry because its reflects their origin rather | 3349 // page) from the NavigationEntry because its reflects their origin rather |
3347 // than the display one (returned by GetURL) which may be different (like | 3350 // than the display one (returned by GetURL) which may be different (like |
3348 // having "view-source:" on the front). | 3351 // having "view-source:" on the front). |
3349 NavigationEntry* active_entry = nc.GetActiveEntry(); | 3352 NavigationEntry* active_entry = nc.GetActiveEntry(); |
3350 bool is_savable_url = | 3353 bool is_savable_url = |
3351 SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()); | 3354 SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()); |
3352 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, is_savable_url); | 3355 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, is_savable_url); |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4134 } | 4137 } |
4135 | 4138 |
4136 bool Browser::IsPinned(TabContents* source) { | 4139 bool Browser::IsPinned(TabContents* source) { |
4137 int index = tabstrip_model_.GetIndexOfTabContents(source); | 4140 int index = tabstrip_model_.GetIndexOfTabContents(source); |
4138 if (index == TabStripModel::kNoTab) { | 4141 if (index == TabStripModel::kNoTab) { |
4139 NOTREACHED() << "IsPinned called for tab not in our strip"; | 4142 NOTREACHED() << "IsPinned called for tab not in our strip"; |
4140 return false; | 4143 return false; |
4141 } | 4144 } |
4142 return tabstrip_model_.IsTabPinned(index); | 4145 return tabstrip_model_.IsTabPinned(index); |
4143 } | 4146 } |
OLD | NEW |