diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/background_mode_manager.cc | 42 | ||||
-rw-r--r-- | chrome/browser/background_mode_manager.h | 16 | ||||
-rw-r--r-- | chrome/browser/background_mode_manager_unittest.cc | 49 | ||||
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.h | 6 | ||||
-rw-r--r-- | chrome/browser/cocoa/preferences_window_controller.mm | 35 | ||||
-rw-r--r-- | chrome/browser/dom_ui/options/advanced_options_handler.cc | 13 | ||||
-rw-r--r-- | chrome/browser/gtk/options/advanced_contents_gtk.cc | 108 | ||||
-rw-r--r-- | chrome/browser/gtk/options/advanced_contents_gtk.h | 2 | ||||
-rw-r--r-- | chrome/browser/options_util.cc | 1 | ||||
-rw-r--r-- | chrome/browser/resources/options.html | 1 | ||||
-rw-r--r-- | chrome/browser/resources/options/advanced_options.html | 15 | ||||
-rw-r--r-- | chrome/browser/ui/views/options/advanced_contents_view.cc | 91 |
12 files changed, 8 insertions, 371 deletions
diff --git a/chrome/browser/background_mode_manager.cc b/chrome/browser/background_mode_manager.cc index 7d883b2..8f78dfb 100644 --- a/chrome/browser/background_mode_manager.cc +++ b/chrome/browser/background_mode_manager.cc @@ -196,10 +196,6 @@ BackgroundModeManager::BackgroundModeManager(Profile* profile, registrar_.Add(this, NotificationType::APP_TERMINATING, NotificationService::AllSources()); - // Listen for changes to the background mode preference. - pref_registrar_.Init(profile_->GetPrefs()); - pref_registrar_.Add(prefs::kBackgroundModeEnabled, this); - applications_.AddObserver(this); } @@ -213,10 +209,6 @@ BackgroundModeManager::~BackgroundModeManager() { EndBackgroundMode(); } -bool BackgroundModeManager::IsBackgroundModeEnabled() { - return profile_->GetPrefs()->GetBoolean(prefs::kBackgroundModeEnabled); -} - bool BackgroundModeManager::IsLaunchOnStartupResetAllowed() { return profile_->GetPrefs()->GetBoolean(prefs::kLaunchOnStartupResetAllowed); } @@ -239,8 +231,7 @@ void BackgroundModeManager::Observe(NotificationType type, // don't want to stomp on user choice every time we start and load // registered extensions. #if !defined(OS_MACOSX) - EnableLaunchOnStartup(IsBackgroundModeEnabled() && - background_app_count_ > 0); + EnableLaunchOnStartup(background_app_count_ > 0); #endif break; case NotificationType::EXTENSION_LOADED: @@ -280,11 +271,6 @@ void BackgroundModeManager::Observe(NotificationType type, // try to re-enter/exit background mode again. registrar_.RemoveAll(); break; - case NotificationType::PREF_CHANGED: - DCHECK(0 == Details<std::string>(details).ptr()->compare( - prefs::kBackgroundModeEnabled)); - OnBackgroundModePrefChanged(); - break; default: NOTREACHED(); break; @@ -302,28 +288,11 @@ void BackgroundModeManager::EndKeepAliveForStartup() { } } -void BackgroundModeManager::OnBackgroundModePrefChanged() { - // Background mode has been enabled/disabled in preferences, so update our - // state accordingly. - if (IsBackgroundModeEnabled() && !in_background_mode_ && - background_app_count_ > 0) { - // We should be in background mode, but we're not, so switch to background - // mode. - EnableLaunchOnStartup(true); - StartBackgroundMode(); - } - if (!IsBackgroundModeEnabled() && in_background_mode_) { - // We're in background mode, but we shouldn't be any longer. - EnableLaunchOnStartup(false); - EndBackgroundMode(); - } -} - void BackgroundModeManager::OnBackgroundAppLoaded() { // When a background app loads, increment our count and also enable // KeepAlive mode if the preference is set. background_app_count_++; - if (background_app_count_ == 1 && IsBackgroundModeEnabled()) + if (background_app_count_ == 1) StartBackgroundMode(); } @@ -347,7 +316,7 @@ void BackgroundModeManager::OnBackgroundAppUnloaded() { // KeepAlive mode if appropriate. background_app_count_--; DCHECK(background_app_count_ >= 0); - if (background_app_count_ == 0 && IsBackgroundModeEnabled()) + if (background_app_count_ == 0) EndBackgroundMode(); } @@ -364,14 +333,14 @@ void BackgroundModeManager::EndBackgroundMode() { void BackgroundModeManager::OnBackgroundAppInstalled() { // We're installing a background app. If this is the first background app // being installed, make sure we are set to launch on startup. - if (IsBackgroundModeEnabled() && background_app_count_ == 0) + if (background_app_count_ == 0) EnableLaunchOnStartup(true); } void BackgroundModeManager::OnBackgroundAppUninstalled() { // When uninstalling a background app, disable launch on startup if // we have no more background apps. - if (IsBackgroundModeEnabled() && background_app_count_ == 0) + if (background_app_count_ == 0) EnableLaunchOnStartup(false); } @@ -581,6 +550,5 @@ Browser* BackgroundModeManager::GetBrowserWindow() { // static void BackgroundModeManager::RegisterUserPrefs(PrefService* prefs) { - prefs->RegisterBooleanPref(prefs::kBackgroundModeEnabled, true); prefs->RegisterBooleanPref(prefs::kLaunchOnStartupResetAllowed, false); } diff --git a/chrome/browser/background_mode_manager.h b/chrome/browser/background_mode_manager.h index 666b4f7..dbae6e5 100644 --- a/chrome/browser/background_mode_manager.h +++ b/chrome/browser/background_mode_manager.h @@ -27,10 +27,9 @@ class StatusTray; // are no open browser windows. // // Chrome enters background mode whenever there is an application with the -// "background" permission installed and the appropriate user preference is -// set (kBackgroundModeEnabled). This class monitors the set of installed/loaded -// extensions to ensure that Chrome enters/exits background mode at the -// appropriate time. +// "background" permission installed. This class monitors the set of +// installed/loaded extensions to ensure that Chrome enters/exits background +// mode at the appropriate time. // // When Chrome is in background mode, it will continue running even after the // last browser window is closed, until the user explicitly exits the app. @@ -94,12 +93,6 @@ class BackgroundModeManager // launch-on-startup is disabled if appropriate. void OnBackgroundAppUninstalled(); - // Invoked when the kBackgroundModeEnabled preference has changed. - void OnBackgroundModePrefChanged(); - - // Returns true if the background mode preference is enabled - bool IsBackgroundModeEnabled(); - // Returns true if chrome has set "launch on startup" property for itself // earlier and is allowed to reset it later, reducing likelihood of // overriding user choices. @@ -183,9 +176,6 @@ class BackgroundModeManager // Reference to our status icon (if any) - owned by the StatusTray. StatusIcon* status_icon_; - // Ensure observed preferences are properly cleaned up. - PrefChangeRegistrar pref_registrar_; - DISALLOW_COPY_AND_ASSIGN(BackgroundModeManager); }; diff --git a/chrome/browser/background_mode_manager_unittest.cc b/chrome/browser/background_mode_manager_unittest.cc index cd87ce5..989c72d 100644 --- a/chrome/browser/background_mode_manager_unittest.cc +++ b/chrome/browser/background_mode_manager_unittest.cc @@ -66,52 +66,3 @@ TEST_F(BackgroundModeManagerTest, BackgroundAppInstallUninstall) { manager.OnBackgroundAppUnloaded(); manager.OnBackgroundAppUninstalled(); } - -TEST_F(BackgroundModeManagerTest, BackgroundPrefDisabled) { - InSequence s; - TestingProfile profile; - profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, false); - TestBackgroundModeManager manager(&profile, command_line_.get()); - EXPECT_CALL(manager, CreateStatusTrayIcon()).Times(0); - // Should not change launch on startup status when installing/uninstalling - // if background mode is disabled. - EXPECT_CALL(manager, EnableLaunchOnStartup(true)).Times(0); - manager.OnBackgroundAppInstalled(); - manager.OnBackgroundAppLoaded(); - EXPECT_FALSE(BrowserList::WillKeepAlive()); - manager.OnBackgroundAppUnloaded(); - manager.OnBackgroundAppUninstalled(); -} - -TEST_F(BackgroundModeManagerTest, BackgroundPrefDynamicDisable) { - InSequence s; - TestingProfile profile; - TestBackgroundModeManager manager(&profile, command_line_.get()); - EXPECT_CALL(manager, EnableLaunchOnStartup(true)); - EXPECT_CALL(manager, CreateStatusTrayIcon()); - EXPECT_CALL(manager, EnableLaunchOnStartup(false)); - EXPECT_CALL(manager, RemoveStatusTrayIcon()); - manager.OnBackgroundAppInstalled(); - manager.OnBackgroundAppLoaded(); - EXPECT_TRUE(BrowserList::WillKeepAlive()); - // Disable status on the fly. - profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, false); - // Manually notify background mode manager that pref has changed - manager.OnBackgroundModePrefChanged(); - EXPECT_FALSE(BrowserList::WillKeepAlive()); -} - -TEST_F(BackgroundModeManagerTest, BackgroundPrefDynamicEnable) { - InSequence s; - TestingProfile profile; - TestBackgroundModeManager manager(&profile, command_line_.get()); - profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, false); - EXPECT_CALL(manager, EnableLaunchOnStartup(true)); - EXPECT_CALL(manager, CreateStatusTrayIcon()); - manager.OnBackgroundAppInstalled(); - manager.OnBackgroundAppLoaded(); - EXPECT_FALSE(BrowserList::WillKeepAlive()); - // Enable status on the fly. - profile.GetPrefs()->SetBoolean(prefs::kBackgroundModeEnabled, true); - EXPECT_TRUE(BrowserList::WillKeepAlive()); -} diff --git a/chrome/browser/cocoa/preferences_window_controller.h b/chrome/browser/cocoa/preferences_window_controller.h index 51aa79b..cfec955 100644 --- a/chrome/browser/cocoa/preferences_window_controller.h +++ b/chrome/browser/cocoa/preferences_window_controller.h @@ -144,11 +144,6 @@ class ProfileSyncService; BOOL safeBrowsingEnabled_; BOOL metricsReportingEnabled_; BOOL proxiesConfigureButtonEnabled_; - IBOutlet NSTextField* backgroundModeTitle_; - IBOutlet NSButton* backgroundModeCheckbox_; - IBOutlet NSTextField* backgroundModeDescription_; - IBOutlet NSButton* backgroundModeLearnMore_; - BooleanPrefMember backgroundModeEnabled_; } // Designated initializer. |profile| should not be NULL. @@ -194,7 +189,6 @@ class ProfileSyncService; - (IBAction)changeFontAndLanguageSettings:(id)sender; - (IBAction)openProxyPreferences:(id)sender; - (IBAction)showCertificates:(id)sender; -- (IBAction)backgroundModeLearnMore:(id)sender; - (IBAction)resetToDefaults:(id)sender; // When a toolbar button is clicked diff --git a/chrome/browser/cocoa/preferences_window_controller.mm b/chrome/browser/cocoa/preferences_window_controller.mm index fb59ff1..1e556a8 100644 --- a/chrome/browser/cocoa/preferences_window_controller.mm +++ b/chrome/browser/cocoa/preferences_window_controller.mm @@ -399,7 +399,6 @@ CGFloat AutoSizeUnderTheHoodContent(NSView* view, - (void)setFileHandlerUIEnabled:(BOOL)value; - (void)setTranslateEnabled:(BOOL)value; - (void)setTabsToLinks:(BOOL)value; -- (void)setBackgroundModeEnabled:(BOOL)value; - (void)displayPreferenceViewForPage:(OptionsPage)page animate:(BOOL)animate; - (void)resetSubViews; @@ -602,15 +601,6 @@ class ManagedPrefsBannerState : public policy::ManagedPrefsBannerBase { RemoveViewFromView(underTheHoodContentView_, enableLoggingCheckbox_); #endif // !defined(GOOGLE_CHROME_BUILD) - // If BackgroundMode is not enabled, hide the related prefs UI. - if (!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableBackgroundMode)) { - RemoveViewFromView(underTheHoodContentView_, backgroundModeTitle_); - RemoveViewFromView(underTheHoodContentView_, backgroundModeCheckbox_); - RemoveViewFromView(underTheHoodContentView_, backgroundModeDescription_); - RemoveViewFromView(underTheHoodContentView_, backgroundModeLearnMore_); - } - // There are four problem children within the groups: // Basics - Default Browser // Personal Stuff - Sync @@ -877,8 +867,6 @@ class ManagedPrefsBannerState : public policy::ManagedPrefsBannerBase { autoOpenFiles_.Init( prefs::kDownloadExtensionsToOpen, prefs_, observer_.get()); translateEnabled_.Init(prefs::kEnableTranslate, prefs_, observer_.get()); - backgroundModeEnabled_.Init(prefs::kBackgroundModeEnabled, prefs_, - observer_.get()); tabsToLinks_.Init(prefs::kWebkitTabsToLinks, prefs_, observer_.get()); // During unit tests, there is no local state object, so we fall back to @@ -1531,10 +1519,6 @@ const int kDisabledIndex = 1; else if (*prefName == prefs::kEnableTranslate) { [self setTranslateEnabled:translateEnabled_.GetValue() ? YES : NO]; } - else if (*prefName == prefs::kBackgroundModeEnabled) { - [self setBackgroundModeEnabled:backgroundModeEnabled_.GetValue() ? - YES : NO]; - } else if (*prefName == prefs::kWebkitTabsToLinks) { [self setTabsToLinks:tabsToLinks_.GetValue() ? YES : NO]; } @@ -1598,12 +1582,6 @@ const int kDisabledIndex = 1; browser::ShowOptionsURL(profile_, url); } -- (IBAction)backgroundModeLearnMore:(id)sender { - browser::ShowOptionsURL( - profile_, - GURL(l10n_util::GetStringUTF16(IDS_LEARN_MORE_BACKGROUND_MODE_URL))); -} - - (IBAction)resetAutoOpenFiles:(id)sender { profile_->GetDownloadManager()->download_prefs()->ResetAutoOpen(); [self recordUserAction:UserMetricsAction("Options_ResetAutoOpenFiles")]; @@ -1793,19 +1771,6 @@ const int kDisabledIndex = 1; translateEnabled_.SetValue(value); } -- (BOOL)backgroundModeEnabled { - return backgroundModeEnabled_.GetValue(); -} - -- (void)setBackgroundModeEnabled:(BOOL)value { - if (value) { - [self recordUserAction:UserMetricsAction("Options_BackgroundMode_Enable")]; - } else { - [self recordUserAction:UserMetricsAction("Options_BackgroundMode_Disable")]; - } - backgroundModeEnabled_.SetValue(value); -} - - (BOOL)tabsToLinks { return tabsToLinks_.GetValue(); } diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.cc b/chrome/browser/dom_ui/options/advanced_options_handler.cc index 4434551..2078368 100644 --- a/chrome/browser/dom_ui/options/advanced_options_handler.cc +++ b/chrome/browser/dom_ui/options/advanced_options_handler.cc @@ -135,19 +135,6 @@ void AdvancedOptionsHandler::GetLocalizedValues( l10n_util::GetStringUTF16(IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE)); localized_strings->SetString("translateEnableTranslate", l10n_util::GetStringUTF16(IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE)); - // Add ChromeApps preferences if background mode is runtime-enabled. - bool background_mode_enabled = CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableBackgroundMode); - localized_strings->SetString("enable-background-mode", - background_mode_enabled ? "true" : "false"); - localized_strings->SetString("advancedSectionTitleChromeApps", - l10n_util::GetStringUTF16( - IDS_OPTIONS_ADVANCED_SECTION_TITLE_CHROME_APPS)); - localized_strings->SetString("chromeAppsEnableBackgroundMode", - l10n_util::GetStringUTF16( - IDS_OPTIONS_CHROME_APPS_ENABLE_BACKGROUND_MODE)); - localized_strings->SetString("chromeAppsLearnMoreBackgroundModeURL", - l10n_util::GetStringUTF16(IDS_LEARN_MORE_BACKGROUND_MODE_URL)); #if !defined(OS_CHROMEOS) // Add the cloud print proxy management ui section if it's been runtime // enabled. diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc index 26238b1..c941aab 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.cc +++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc @@ -595,106 +595,6 @@ void TranslateSection::OnTranslateClicked(GtkWidget* widget) { } /////////////////////////////////////////////////////////////////////////////// -// ChromeAppsSection - -class ChromeAppsSection : public OptionsPageBase { - public: - explicit ChromeAppsSection(Profile* profile); - virtual ~ChromeAppsSection() {} - - GtkWidget* get_page_widget() const { - return page_; - } - - private: - // Overridden from OptionsPageBase. - virtual void NotifyPrefChanged(const std::string* pref_name); - - CHROMEGTK_CALLBACK_0(ChromeAppsSection, void, OnBackgroundModeClicked); - CHROMEGTK_CALLBACK_0(ChromeAppsSection, void, OnLearnMoreLinkClicked); - - // Preferences for this section: - BooleanPrefMember enable_background_mode_; - - // The widget containing the options for this section. - GtkWidget* page_; - - // The checkbox. - GtkWidget* background_mode_checkbox_; - - // Flag to ignore gtk callbacks while we are loading prefs, to avoid - // then turning around and saving them again. - bool pref_changing_; - - scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_; - - DISALLOW_COPY_AND_ASSIGN(ChromeAppsSection); -}; - -ChromeAppsSection::ChromeAppsSection(Profile* profile) - : OptionsPageBase(profile), - pref_changing_(true) { - page_ = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); - - accessible_widget_helper_.reset(new AccessibleWidgetHelper(page_, profile)); - - background_mode_checkbox_ = CreateCheckButtonWithWrappedLabel( - IDS_OPTIONS_CHROME_APPS_ENABLE_BACKGROUND_MODE); - gtk_box_pack_start(GTK_BOX(page_), background_mode_checkbox_, - FALSE, FALSE, 0); - g_signal_connect(background_mode_checkbox_, "clicked", - G_CALLBACK(OnBackgroundModeClickedThunk), this); - accessible_widget_helper_->SetWidgetName( - background_mode_checkbox_, - IDS_OPTIONS_CHROME_APPS_ENABLE_BACKGROUND_MODE); - - // Init member prefs so we can update the controls if prefs change. - enable_background_mode_.Init(prefs::kBackgroundModeEnabled, - profile->GetPrefs(), this); - - GtkWidget* learn_more_link = gtk_chrome_link_button_new( - l10n_util::GetStringUTF8(IDS_LEARN_MORE).c_str()); - // Stick it in an hbox so it doesn't expand to the whole width. - GtkWidget* learn_more_hbox = gtk_hbox_new(FALSE, 0); - gtk_box_pack_start(GTK_BOX(learn_more_hbox), learn_more_link, - FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(page_), learn_more_hbox, - FALSE, FALSE, 0); - g_signal_connect(learn_more_link, "clicked", - G_CALLBACK(OnLearnMoreLinkClickedThunk), this); - - NotifyPrefChanged(NULL); -} - -void ChromeAppsSection::NotifyPrefChanged(const std::string* pref_name) { - pref_changing_ = true; - if (!pref_name || *pref_name == prefs::kBackgroundModeEnabled) { - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(background_mode_checkbox_), - enable_background_mode_.GetValue()); - } - pref_changing_ = false; -} - -void ChromeAppsSection::OnBackgroundModeClicked(GtkWidget* widget) { - if (pref_changing_) - return; - bool enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); - UserMetricsRecordAction( - enabled ? - UserMetricsAction("Options_BackgroundMode_Enable") : - UserMetricsAction("Options_BackgroundMode_Disable"), - profile()->GetPrefs()); - enable_background_mode_.SetValue(enabled); -} - -void ChromeAppsSection::OnLearnMoreLinkClicked(GtkWidget* widget) { - browser::ShowOptionsURL( - profile(), - GURL(l10n_util::GetStringUTF8(IDS_LEARN_MORE_BACKGROUND_MODE_URL))); -} - - -/////////////////////////////////////////////////////////////////////////////// // PrivacySection class PrivacySection : public OptionsPageBase { @@ -1366,13 +1266,5 @@ void AdvancedContentsGtk::Init() { l10n_util::GetStringUTF8(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY), security_section_->get_page_widget(), false); - // Add ChromeApps preferences if background mode is runtime-enabled. - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableBackgroundMode)) { - chrome_apps_section_.reset(new ChromeAppsSection(profile_)); - options_builder->AddOptionGroup(l10n_util::GetStringUTF8( - IDS_OPTIONS_ADVANCED_SECTION_TITLE_CHROME_APPS), - chrome_apps_section_->get_page_widget(), false); - } page_ = options_builder->get_page_widget(); } diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.h b/chrome/browser/gtk/options/advanced_contents_gtk.h index f39d6cc..28eb3bd 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.h +++ b/chrome/browser/gtk/options/advanced_contents_gtk.h @@ -12,7 +12,6 @@ #include "base/scoped_ptr.h" class Profile; -class ChromeAppsSection; class DownloadSection; class NetworkSection; class PrivacySection; @@ -36,7 +35,6 @@ class AdvancedContentsGtk { Profile* profile_; // The sections of the page. - scoped_ptr<ChromeAppsSection> chrome_apps_section_; scoped_ptr<DownloadSection> download_section_; scoped_ptr<NetworkSection> network_section_; scoped_ptr<TranslateSection> translate_section_; diff --git a/chrome/browser/options_util.cc b/chrome/browser/options_util.cc index 933ef63..5d46ab5 100644 --- a/chrome/browser/options_util.cc +++ b/chrome/browser/options_util.cc @@ -27,7 +27,6 @@ void OptionsUtil::ResetToDefaults(Profile* profile) { const char* kUserPrefs[] = { prefs::kAcceptLanguages, prefs::kAlternateErrorPagesEnabled, - prefs::kBackgroundModeEnabled, prefs::kClearSiteDataOnExit, prefs::kCookieBehavior, prefs::kDefaultCharset, diff --git a/chrome/browser/resources/options.html b/chrome/browser/resources/options.html index bf43df2..c9e6db7 100644 --- a/chrome/browser/resources/options.html +++ b/chrome/browser/resources/options.html @@ -1,7 +1,6 @@ <!DOCTYPE HTML> <html i18n-values="dir:textdirection; - enable-background-mode:enable-background-mode; enable-cloud-print-proxy:enable-cloud-print-proxy" id="t"> <head> diff --git a/chrome/browser/resources/options/advanced_options.html b/chrome/browser/resources/options/advanced_options.html index f58d9af..92da57c 100644 --- a/chrome/browser/resources/options/advanced_options.html +++ b/chrome/browser/resources/options/advanced_options.html @@ -176,21 +176,6 @@ </if> </div> </section> - <section id="background-mode-section"> - <h3 i18n-content="advancedSectionTitleChromeApps"></h3> - <div> - <label class="checkbox"> - <input pref="background_mode.enabled" - metric="Options_BackgroundMode" type="checkbox"> - <span i18n-content="chromeAppsEnableBackgroundMode"></span> - </label> - <div> - <a target="_blank" - i18n-content="learnMore" - i18n-values="href:chromeAppsLearnMoreBackgroundModeURL"></a> - </div> - </div> - </section> <if expr="not pp_ifdef('chromeos')"> <section id="cloud-print-proxy-section"> <h3 i18n-content="advancedSectionTitleCloudPrint"></h3> diff --git a/chrome/browser/ui/views/options/advanced_contents_view.cc b/chrome/browser/ui/views/options/advanced_contents_view.cc index e24179f..275fae7 100644 --- a/chrome/browser/ui/views/options/advanced_contents_view.cc +++ b/chrome/browser/ui/views/options/advanced_contents_view.cc @@ -1310,92 +1310,6 @@ void TranslateSection::NotifyPrefChanged(const std::string* pref_name) { } //////////////////////////////////////////////////////////////////////////////// -// ChromeAppsSection - -class ChromeAppsSection : public AdvancedSection, - public views::ButtonListener, - public views::LinkController { - public: - explicit ChromeAppsSection(Profile* profile); - virtual ~ChromeAppsSection() {} - - // Overridden from views::ButtonListener: - virtual void ButtonPressed(views::Button* sender, const views::Event& event); - // Overridden from views::LinkController: - virtual void LinkActivated(views::Link* source, int event_flags); - - protected: - // OptionsPageView overrides: - virtual void InitControlLayout(); - virtual void NotifyPrefChanged(const std::string* pref_name); - - private: - // Controls for this section: - views::Checkbox* enable_background_mode_checkbox_; - views::Link* learn_more_link_; - - // Preferences for this section: - BooleanPrefMember enable_background_mode_; - - DISALLOW_COPY_AND_ASSIGN(ChromeAppsSection); -}; - -ChromeAppsSection::ChromeAppsSection(Profile* profile) - : enable_background_mode_checkbox_(NULL), - learn_more_link_(NULL), - AdvancedSection(profile, l10n_util::GetString( - IDS_OPTIONS_ADVANCED_SECTION_TITLE_CHROME_APPS)) { -} - -void ChromeAppsSection::ButtonPressed( - views::Button* sender, const views::Event& event) { - DCHECK(sender == enable_background_mode_checkbox_); - bool enabled = enable_background_mode_checkbox_->checked(); - UserMetricsRecordAction(enabled ? - UserMetricsAction("Options_BackgroundMode_Enable") : - UserMetricsAction("Options_BackgroundMode_Disable"), - profile()->GetPrefs()); - enable_background_mode_.SetValue(enabled); -} - -void ChromeAppsSection::LinkActivated(views::Link* source, int event_flags) { - DCHECK(source == learn_more_link_); - browser::ShowOptionsURL( - profile(), - GURL(l10n_util::GetString(IDS_LEARN_MORE_BACKGROUND_MODE_URL))); -} - -void ChromeAppsSection::InitControlLayout() { - AdvancedSection::InitControlLayout(); - - GridLayout* layout = new GridLayout(contents_); - contents_->SetLayoutManager(layout); - - AddIndentedColumnSet(layout, 0); - - enable_background_mode_checkbox_ = new views::Checkbox( - l10n_util::GetString(IDS_OPTIONS_CHROME_APPS_ENABLE_BACKGROUND_MODE)); - enable_background_mode_checkbox_->set_listener(this); - AddWrappingCheckboxRow(layout, enable_background_mode_checkbox_, 0, true); - - // Init member pref so we can update the controls if prefs change. - enable_background_mode_.Init(prefs::kBackgroundModeEnabled, - profile()->GetPrefs(), this); - - // Add our link to the help center page for this feature. - learn_more_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE)); - learn_more_link_->SetController(this); - AddLeadingControl(layout, learn_more_link_, 0, false); -} - -void ChromeAppsSection::NotifyPrefChanged(const std::string* pref_name) { - if (!pref_name || *pref_name == prefs::kBackgroundModeEnabled) { - enable_background_mode_checkbox_->SetChecked( - enable_background_mode_.GetValue()); - } -} - -//////////////////////////////////////////////////////////////////////////////// // CloudPrintProxySection class CloudPrintProxySection : public AdvancedSection, @@ -1681,11 +1595,6 @@ void AdvancedContentsView::InitControlLayout() { layout->StartRow(0, single_column_view_set_id); layout->AddView(new CloudPrintProxySection(profile())); } - if (CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableBackgroundMode)) { - layout->StartRow(0, single_column_view_set_id); - layout->AddView(new ChromeAppsSection(profile())); - } } //////////////////////////////////////////////////////////////////////////////// |