Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: chrome/browser/browser.cc

Issue 3122014: Initial change that allows to disable bookmarks in Chrome for Chrome OS (BWSI... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
1083 command_updater_.UpdateCommandEnabled( 1083 command_updater_.UpdateCommandEnabled(
1084 IDC_FOCUS_PREVIOUS_PANE, main_not_fullscreen_or_popup); 1084 IDC_FOCUS_PREVIOUS_PANE, main_not_fullscreen_or_popup);
1085 command_updater_.UpdateCommandEnabled( 1085 command_updater_.UpdateCommandEnabled(
1086 IDC_FOCUS_BOOKMARKS, main_not_fullscreen_or_popup); 1086 IDC_FOCUS_BOOKMARKS, main_not_fullscreen_or_popup);
1087 command_updater_.UpdateCommandEnabled( 1087 command_updater_.UpdateCommandEnabled(
1088 IDC_FOCUS_CHROMEOS_STATUS, main_not_fullscreen_or_popup); 1088 IDC_FOCUS_CHROMEOS_STATUS, main_not_fullscreen_or_popup);
1089 1089
1090 // Show various bits of UI 1090 // Show various bits of UI
1091 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui); 1091 command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui);
1092 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui); 1092 command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui);
1093 #if defined(OS_CHROMEOS)
1094 command_updater_.UpdateCommandEnabled(
sky 2010/08/17 17:58:39 Slews of ifdefs like this make the code really har
Dmitry Polukhin 2010/08/18 08:37:51 I don't see "defaults::", I see only "browser_defa
1095 IDC_SHOW_BOOKMARK_BAR,
1096 show_main_ui && !CommandLine::ForCurrentProcess()->
1097 HasSwitch(switches::kDisableBookmarks));
1098 #else
1093 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui); 1099 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui);
1100 #endif
1094 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); 1101 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui);
1095 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, 1102 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS,
1096 show_main_ui && profile_->IsSyncAccessible()); 1103 show_main_ui && profile_->IsSyncAccessible());
1097 1104
1098 #if defined(ENABLE_REMOTING) 1105 #if defined(ENABLE_REMOTING)
1099 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) { 1106 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) {
1100 command_updater_.UpdateCommandEnabled(IDC_REMOTING_SETUP, show_main_ui); 1107 command_updater_.UpdateCommandEnabled(IDC_REMOTING_SETUP, show_main_ui);
1101 } 1108 }
1102 #endif 1109 #endif
1103 1110
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
3234 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); 3241 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true);
3235 3242
3236 // Show various bits of UI 3243 // Show various bits of UI
3237 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true); 3244 command_updater_.UpdateCommandEnabled(IDC_OPEN_FILE, true);
3238 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); 3245 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false);
3239 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS, true); 3246 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS, true);
3240 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_CONSOLE, true); 3247 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_CONSOLE, true);
3241 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_INSPECT, true); 3248 command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_INSPECT, true);
3242 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true); 3249 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true);
3243 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true); 3250 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true);
3251 #if defined(OS_CHROMEOS)
3252 command_updater_.UpdateCommandEnabled(
3253 IDC_SHOW_BOOKMARK_MANAGER,
3254 !CommandLine::ForCurrentProcess()->
3255 HasSwitch(switches::kDisableBookmarks));
3256 #else
3244 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true); 3257 command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true);
3258 #endif
3245 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); 3259 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true);
3246 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true); 3260 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true);
3247 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true); 3261 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true);
3248 3262
3249 #if defined(OS_CHROMEOS) 3263 #if defined(OS_CHROMEOS)
3250 command_updater_.UpdateCommandEnabled(IDC_SEARCH, true); 3264 command_updater_.UpdateCommandEnabled(IDC_SEARCH, true);
3251 command_updater_.UpdateCommandEnabled(IDC_SYSTEM_OPTIONS, true); 3265 command_updater_.UpdateCommandEnabled(IDC_SYSTEM_OPTIONS, true);
3252 command_updater_.UpdateCommandEnabled(IDC_INTERNET_OPTIONS, true); 3266 command_updater_.UpdateCommandEnabled(IDC_INTERNET_OPTIONS, true);
3253 #endif 3267 #endif
3254 3268
(...skipping 25 matching lines...) Expand all
3280 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window); 3294 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_4, normal_window);
3281 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window); 3295 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_5, normal_window);
3282 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window); 3296 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_6, normal_window);
3283 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window); 3297 command_updater_.UpdateCommandEnabled(IDC_SELECT_TAB_7, normal_window);
3284 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window); 3298 command_updater_.UpdateCommandEnabled(IDC_SELECT_LAST_TAB, normal_window);
3285 #if defined(OS_MACOSX) 3299 #if defined(OS_MACOSX)
3286 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window); 3300 command_updater_.UpdateCommandEnabled(IDC_TABPOSE, normal_window);
3287 #endif 3301 #endif
3288 3302
3289 // Page-related commands 3303 // Page-related commands
3304 #if defined(OS_CHROMEOS)
3305 command_updater_.UpdateCommandEnabled(
3306 IDC_BOOKMARK_PAGE,
3307 normal_window && !CommandLine::ForCurrentProcess()->
3308 HasSwitch(switches::kDisableBookmarks));
3309 #else
3290 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, normal_window); 3310 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, normal_window);
3311 #endif
3291 3312
3292 // Clipboard commands 3313 // Clipboard commands
3293 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, non_devtools_window); 3314 command_updater_.UpdateCommandEnabled(IDC_COPY_URL, non_devtools_window);
3294 3315
3295 // Find-in-page 3316 // Find-in-page
3296 command_updater_.UpdateCommandEnabled(IDC_FIND, non_devtools_window); 3317 command_updater_.UpdateCommandEnabled(IDC_FIND, non_devtools_window);
3297 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, non_devtools_window); 3318 command_updater_.UpdateCommandEnabled(IDC_FIND_NEXT, non_devtools_window);
3298 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, non_devtools_window); 3319 command_updater_.UpdateCommandEnabled(IDC_FIND_PREVIOUS, non_devtools_window);
3299 3320
3300 // AutoFill 3321 // AutoFill
(...skipping 25 matching lines...) Expand all
3326 bool non_app_window = !(type() & TYPE_APP); 3347 bool non_app_window = !(type() & TYPE_APP);
3327 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, 3348 command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB,
3328 non_app_window && CanDuplicateContentsAt(selected_index())); 3349 non_app_window && CanDuplicateContentsAt(selected_index()));
3329 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, 3350 command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB,
3330 non_app_window && tab_count() > 1); 3351 non_app_window && tab_count() > 1);
3331 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, 3352 command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB,
3332 non_app_window && tab_count() > 1); 3353 non_app_window && tab_count() > 1);
3333 3354
3334 // Page-related commands 3355 // Page-related commands
3335 window_->SetStarredState(current_tab->is_starred()); 3356 window_->SetStarredState(current_tab->is_starred());
3357 #if defined(OS_CHROMEOS)
3358 command_updater_.UpdateCommandEnabled(
3359 IDC_BOOKMARK_ALL_TABS,
3360 CanBookmarkAllTabs() && !CommandLine::ForCurrentProcess()->
3361 HasSwitch(switches::kDisableBookmarks));
3362 #else
3336 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, 3363 command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS,
3337 CanBookmarkAllTabs()); 3364 CanBookmarkAllTabs());
3365 #endif
3338 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, 3366 command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
3339 current_tab->controller().CanViewSource()); 3367 current_tab->controller().CanViewSource());
3340 // Instead of using GetURL here, we use url() (which is the "real" url of the 3368 // Instead of using GetURL here, we use url() (which is the "real" url of the
3341 // page) from the NavigationEntry because its reflects their origin rather 3369 // page) from the NavigationEntry because its reflects their origin rather
3342 // than the display one (returned by GetURL) which may be different (like 3370 // than the display one (returned by GetURL) which may be different (like
3343 // having "view-source:" on the front). 3371 // having "view-source:" on the front).
3344 NavigationEntry* active_entry = nc.GetActiveEntry(); 3372 NavigationEntry* active_entry = nc.GetActiveEntry();
3345 bool is_savable_url = 3373 bool is_savable_url =
3346 SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL()); 3374 SavePackage::IsSavableURL(active_entry ? active_entry->url() : GURL());
3347 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, is_savable_url); 3375 command_updater_.UpdateCommandEnabled(IDC_SAVE_PAGE, is_savable_url);
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
4123 } 4151 }
4124 4152
4125 bool Browser::IsPinned(TabContents* source) { 4153 bool Browser::IsPinned(TabContents* source) {
4126 int index = tabstrip_model_.GetIndexOfTabContents(source); 4154 int index = tabstrip_model_.GetIndexOfTabContents(source);
4127 if (index == TabStripModel::kNoTab) { 4155 if (index == TabStripModel::kNoTab) {
4128 NOTREACHED() << "IsPinned called for tab not in our strip"; 4156 NOTREACHED() << "IsPinned called for tab not in our strip";
4129 return false; 4157 return false;
4130 } 4158 }
4131 return tabstrip_model_.IsTabPinned(index); 4159 return tabstrip_model_.IsTabPinned(index);
4132 } 4160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698