Reland 56669: Initial change that allows to disable bookmarks

Original CL: http://codereview.chromium.org/3191007

Initial change that allows to disable bookmarks in Chrome for Chrome OS
(BWSI mode). Added disable-bookmarks flag and disabled some UI elements.

BUG=chromium-os:4302
TEST=Run Chrome build for Chrome OS with --disable-bookmarks flag and
verify that the corresponding UI is disabled. Verify that BWSI mode runs
with this flag.

Review URL: http://codereview.chromium.org/3156035

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57033 0039d316-1c4b-4281-b951-d872f2087c98
parent ca6c2a9a
......@@ -49,6 +49,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/diagnostics/diagnostics_main.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/platform_util.h"
......@@ -572,6 +573,7 @@ int ChromeMain(int argc, char** argv) {
CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
singleton_command_line->AppendSwitch(switches::kDisableSync);
singleton_command_line->AppendSwitch(switches::kDisableExtensions);
browser_defaults::bookmarks_enabled = false;
}
#endif
......
......@@ -1092,7 +1092,8 @@ void Browser::UpdateCommandsForFullscreenMode(bool is_fullscreen) {
// Show various bits of UI
command_updater_.UpdateCommandEnabled(IDC_DEVELOPER_MENU, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_REPORT_BUG, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_BAR,
browser_defaults::bookmarks_enabled && show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS,
show_main_ui && profile_->IsSyncAccessible());
......@@ -3270,7 +3271,8 @@ void Browser::InitCommandState() {
command_updater_.UpdateCommandEnabled(IDC_DEV_TOOLS_INSPECT, true);
command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, true);
command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, true);
command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER, true);
command_updater_.UpdateCommandEnabled(IDC_SHOW_BOOKMARK_MANAGER,
browser_defaults::bookmarks_enabled);
command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true);
command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE, true);
command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, true);
......@@ -3316,7 +3318,8 @@ void Browser::InitCommandState() {
#endif
// Page-related commands
command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE, normal_window);
command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_PAGE,
browser_defaults::bookmarks_enabled && normal_window);
// Clipboard commands
command_updater_.UpdateCommandEnabled(IDC_COPY_URL, non_devtools_window);
......@@ -3363,7 +3366,7 @@ void Browser::UpdateCommandsForTabState() {
// Page-related commands
window_->SetStarredState(current_tab->is_starred());
command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS,
CanBookmarkAllTabs());
browser_defaults::bookmarks_enabled && CanBookmarkAllTabs());
command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE,
current_tab->controller().CanViewSource());
// Instead of using GetURL here, we use url() (which is the "real" url of the
......
......@@ -77,4 +77,6 @@ const bool kBrowserAliveWithNoWindows = false;
const bool kPhantomTabsEnabled = false;
bool bookmarks_enabled = true;
} // namespace browser_defaults
......@@ -74,6 +74,13 @@ extern const bool kAlwaysOpenIncognitoWindow;
// Are phantom tabs enabled?
extern const bool kPhantomTabsEnabled;
//=============================================================================
// Runtime "const" - set only once after parsing command line option and should
// never be modified after that.
// Are bookmark enabled? True by default.
extern bool bookmarks_enabled;
} // namespace browser_defaults
#endif // CHROME_BROWSER_DEFAULTS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment