From bb95ef9e93adfba1f5ab46de4ae9d523f12ca31c Mon Sep 17 00:00:00 2001 From: "munjal@chromium.org" Date: Thu, 5 Mar 2009 23:20:29 +0000 Subject: Add a command-line disable-p13n and use that to disable p13n related features. Review URL: http://codereview.chromium.org/39029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11050 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/dom_ui/new_tab_ui.cc | 4 +++- chrome/browser/profile.cc | 1 + chrome/browser/views/frame/browser_view.cc | 2 +- chrome/browser/views/options/options_window_view.cc | 11 +++++++---- chrome/browser/views/toolbar_view.cc | 6 ++++-- 5 files changed, 16 insertions(+), 8 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index 79ce95a..923f545 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -828,7 +828,9 @@ void NewTabUI::Init() { AddMessageHandler(new HistoryHandler(this)); AddMessageHandler(new MetricsHandler(this)); #ifdef CHROME_PERSONALIZATION - AddMessageHandler(Personalization::CreateNewTabPageHandler(this)); + if (!Personalization::IsP13NDisabled()) { + AddMessageHandler(Personalization::CreateNewTabPageHandler(this)); + } #endif NewTabHTMLSource* html_source = new NewTabHTMLSource(); diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index 3edd32d..9289c2a 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -862,6 +862,7 @@ void ProfileImpl::StopCreateSessionServiceTimer() { #ifdef CHROME_PERSONALIZATION ProfilePersonalization* ProfileImpl::GetProfilePersonalization() { + DCHECK(!Personalization::IsP13NDisabled()); if (!personalization_.get()) personalization_.reset( Personalization::CreateProfilePersonalization(this)); diff --git a/chrome/browser/views/frame/browser_view.cc b/chrome/browser/views/frame/browser_view.cc index 9f8ae58..207f059 100644 --- a/chrome/browser/views/frame/browser_view.cc +++ b/chrome/browser/views/frame/browser_view.cc @@ -463,7 +463,7 @@ void BrowserView::Init() { #ifdef CHROME_PERSONALIZATION const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - EnablePersonalization(command_line.HasSwitch(switches::kEnableP13n)); + EnablePersonalization(!command_line.HasSwitch(switches::kDisableP13n)); if (IsPersonalizationEnabled()) { personalization_ = Personalization::CreateFramePersonalization( browser_->profile(), this); diff --git a/chrome/browser/views/options/options_window_view.cc b/chrome/browser/views/options/options_window_view.cc index 2090c7e..e301d76 100644 --- a/chrome/browser/views/options/options_window_view.cc +++ b/chrome/browser/views/options/options_window_view.cc @@ -15,6 +15,7 @@ #include "chrome/common/pref_service.h" #include "chrome/common/resource_bundle.h" #ifdef CHROME_PERSONALIZATION +#include "chrome/personalization/personalization.h" #include "chrome/personalization/views/user_data_page_view.h" #endif #include "chrome/views/dialog_delegate.h" @@ -200,10 +201,12 @@ void OptionsWindowView::Init() { content_page, false); #ifdef CHROME_PERSONALIZATION - UserDataPageView* user_data_page = new UserDataPageView(profile_); - tabs_->AddTabAtIndex(tab_index++, - l10n_util::GetString(IDS_OPTIONS_USER_DATA_TAB_LABEL), - user_data_page, false); + if (!Personalization::IsP13NDisabled()) { + UserDataPageView* user_data_page = new UserDataPageView(profile_); + tabs_->AddTabAtIndex(tab_index++, + l10n_util::GetString(IDS_OPTIONS_USER_DATA_TAB_LABEL), + user_data_page, false); + } #endif AdvancedPageView* advanced_page = new AdvancedPageView(profile_); diff --git a/chrome/browser/views/toolbar_view.cc b/chrome/browser/views/toolbar_view.cc index c5e16b4..c1b40c4 100644 --- a/chrome/browser/views/toolbar_view.cc +++ b/chrome/browser/views/toolbar_view.cc @@ -607,8 +607,10 @@ void BrowserToolbarView::RunAppMenu(const CPoint& pt, HWND hwnd) { l10n_util::GetString(IDS_SHOW_DOWNLOADS)); menu.AppendSeparator(); #ifdef CHROME_PERSONALIZATION - menu.AppendMenuItemWithLabel(IDC_P13N_INFO, - Personalization::GetMenuItemInfoText(browser())); + if (!Personalization::IsP13NDisabled()) { + menu.AppendMenuItemWithLabel(IDC_P13N_INFO, + Personalization::GetMenuItemInfoText(browser())); + } #endif menu.AppendMenuItemWithLabel(IDC_CLEAR_BROWSING_DATA, l10n_util::GetString(IDS_CLEAR_BROWSING_DATA)); -- cgit v1.1