summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-20 05:08:05 +0000
committerzelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-20 05:08:05 +0000
commit024617a569d5a45e6aaa61d73895d731ade5041c (patch)
tree075fe8fe139af7be5f207776967e1be369f48f99
parentdcaebdd4d8bf59d322aafc9cb45520db56f931c7 (diff)
downloadchromium_src-024617a569d5a45e6aaa61d73895d731ade5041c.zip
chromium_src-024617a569d5a45e6aaa61d73895d731ade5041c.tar.gz
chromium_src-024617a569d5a45e6aaa61d73895d731ade5041c.tar.bz2
Changed ChromeOS status bar menu handlers to obey --enable-tabbed-options switch and display the new DOM UI when it's used.
BUG=chromium-os:5522 TEST=make sure the new DOM UI option tab opens from status bar drop down menues (language, internet and system settings) Review URL: http://codereview.chromium.org/3142020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56816 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/chrome_dll_resource.h1
-rw-r--r--chrome/browser/app_controller_mac.mm3
-rw-r--r--chrome/browser/browser.cc59
-rw-r--r--chrome/browser/browser.h6
-rw-r--r--chrome/browser/chromeos/frame/browser_view.cc4
-rw-r--r--chrome/browser/gtk/first_run_bubble.cc11
-rw-r--r--chrome/browser/options_window.h1
-rw-r--r--chrome/browser/views/first_run_bubble.cc5
-rw-r--r--chrome/common/url_constants.cc11
-rw-r--r--chrome/common/url_constants.h11
10 files changed, 90 insertions, 22 deletions
diff --git a/chrome/app/chrome_dll_resource.h b/chrome/app/chrome_dll_resource.h
index 7835826..db4e0db 100644
--- a/chrome/app/chrome_dll_resource.h
+++ b/chrome/app/chrome_dll_resource.h
@@ -264,6 +264,7 @@
#define IDC_VIEW_MENU 44000 // OSX only
#define IDC_SYSTEM_OPTIONS 45000 // ChromeOS only
#define IDC_INTERNET_OPTIONS 45100 // ChromeOS only
+#define IDC_LANGUAGE_OPTIONS 45200 // ChromeOS only
#define IDC_HISTORY_MENU 46000 // OSX only
#define IDC_INPUT_METHODS_MENU 46300 // Linux only
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 5dca8ce..ab03de0 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -50,6 +50,7 @@
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "net/base/net_util.h"
@@ -971,7 +972,7 @@ void RecordLastRunAppBundlePath() {
if (parsed_command_line.HasSwitch(switches::kEnableTabbedOptions)) {
if (Browser* browser = ActivateBrowser([self defaultProfile])) {
// Show options tab in the active browser window.
- browser->ShowOptionsTab();
+ browser->ShowOptionsTab(chrome::kDefaultOptionsSubPage);
} else {
// No browser window, so create one for the options tab.
Browser::OpenOptionsWindow([self defaultProfile]);
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index f372e0a..77fb280 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -119,6 +119,7 @@
#endif
#if defined(OS_CHROMEOS)
+#include "chrome/browser/chromeos/options/language_config_view.h"
#include "chrome/browser/views/app_launcher.h"
#endif
@@ -669,7 +670,7 @@ void Browser::OpenHelpWindow(Profile* profile) {
void Browser::OpenOptionsWindow(Profile* profile) {
Browser* browser = Browser::Create(profile);
- browser->ShowOptionsTab();
+ browser->ShowOptionsTab(chrome::kDefaultOptionsSubPage);
browser->window()->Show();
}
#endif
@@ -1805,9 +1806,10 @@ void Browser::ShowBrokenPageTab(TabContents* contents) {
ShowSingletonTab(GURL(report_page_url));
}
-void Browser::ShowOptionsTab() {
- UserMetrics::RecordAction(UserMetricsAction("ShowOptions"), profile_);
- ShowSingletonTab(GURL(chrome::kChromeUIOptionsURL));
+void Browser::ShowOptionsTab(const char* sub_page) {
+ ShowSingletonTab(GURL(StringPrintf("%s%s",
+ chrome::kChromeUIOptionsURL,
+ sub_page)));
}
void Browser::OpenClearBrowsingDataDialog() {
@@ -1817,18 +1819,23 @@ void Browser::OpenClearBrowsingDataDialog() {
}
void Browser::OpenOptionsDialog() {
+ UserMetrics::RecordAction(UserMetricsAction("ShowOptions"), profile_);
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableTabbedOptions)) {
- ShowOptionsTab();
+ ShowOptionsTab(chrome::kDefaultOptionsSubPage);
} else {
- UserMetrics::RecordAction(UserMetricsAction("ShowOptions"), profile_);
ShowOptionsWindow(OPTIONS_PAGE_DEFAULT, OPTIONS_GROUP_NONE, profile_);
}
}
void Browser::OpenKeywordEditor() {
UserMetrics::RecordAction(UserMetricsAction("EditSearchEngines"), profile_);
- window_->ShowSearchEnginesDialog();
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTabbedOptions)) {
+ ShowOptionsTab(chrome::kSearchEnginesOptionsSubPage);
+ } else {
+ window_->ShowSearchEnginesDialog();
+ }
}
void Browser::OpenPasswordManager() {
@@ -1889,17 +1896,50 @@ void Browser::OpenAutoFillHelpTabAndActivate() {
window_->Activate();
}
+void Browser::OpenSearchEngineOptionsDialog() {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTabbedOptions)) {
+ OpenKeywordEditor();
+ } else {
+ ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH,
+ profile_);
+ }
+}
+
#if defined(OS_CHROMEOS)
void Browser::OpenSystemOptionsDialog() {
UserMetrics::RecordAction(UserMetricsAction("OpenSystemOptionsDialog"),
profile_);
- ShowOptionsWindow(OPTIONS_PAGE_SYSTEM, OPTIONS_GROUP_NONE, profile_);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTabbedOptions)) {
+ ShowOptionsTab(chrome::kSystemOptionsSubPage);
+ } else {
+ ShowOptionsWindow(OPTIONS_PAGE_SYSTEM, OPTIONS_GROUP_NONE,
+ profile_);
+ }
}
void Browser::OpenInternetOptionsDialog() {
UserMetrics::RecordAction(UserMetricsAction("OpenInternetOptionsDialog"),
profile_);
- ShowOptionsWindow(OPTIONS_PAGE_INTERNET, OPTIONS_GROUP_NONE, profile_);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTabbedOptions)) {
+ ShowOptionsTab(chrome::kInternetOptionsSubPage);
+ } else {
+ ShowOptionsWindow(OPTIONS_PAGE_INTERNET, OPTIONS_GROUP_DEFAULT_SEARCH,
+ profile_);
+ }
+}
+
+void Browser::OpenLanguageOptionsDialog() {
+ UserMetrics::RecordAction(UserMetricsAction("OpenLanguageOptionsDialog"),
+ profile_);
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTabbedOptions)) {
+ ShowOptionsTab(chrome::kLanguageOptionsSubPage);
+ } else {
+ chromeos::LanguageConfigView::Show(profile_, NULL);
+ }
}
#endif
@@ -2164,6 +2204,7 @@ void Browser::ExecuteCommandWithDisposition(
#if defined(OS_CHROMEOS)
case IDC_SYSTEM_OPTIONS: OpenSystemOptionsDialog(); break;
case IDC_INTERNET_OPTIONS: OpenInternetOptionsDialog(); break;
+ case IDC_LANGUAGE_OPTIONS: OpenLanguageOptionsDialog(); break;
#endif
default:
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h
index 12def80..4c99238 100644
--- a/chrome/browser/browser.h
+++ b/chrome/browser/browser.h
@@ -522,7 +522,7 @@ class Browser : public TabStripModelDelegate,
void ShowDownloadsTab();
void ShowExtensionsTab();
void ShowBrokenPageTab(TabContents* contents);
- void ShowOptionsTab();
+ void ShowOptionsTab(const char* sub_page);
void OpenClearBrowsingDataDialog();
void OpenOptionsDialog();
void OpenKeywordEditor();
@@ -539,9 +539,11 @@ class Browser : public TabStripModelDelegate,
void OpenThemeGalleryTabAndActivate();
void OpenAutoFillHelpTabAndActivate();
void OpenPrivacyDashboardTabAndActivate();
+ void OpenSearchEngineOptionsDialog();
#if defined(OS_CHROMEOS)
- void OpenSystemOptionsDialog();
void OpenInternetOptionsDialog();
+ void OpenLanguageOptionsDialog();
+ void OpenSystemOptionsDialog();
#endif
virtual void UpdateDownloadShelfVisibility(bool visible);
diff --git a/chrome/browser/chromeos/frame/browser_view.cc b/chrome/browser/chromeos/frame/browser_view.cc
index f88f57b..3bce13b 100644
--- a/chrome/browser/chromeos/frame/browser_view.cc
+++ b/chrome/browser/chromeos/frame/browser_view.cc
@@ -12,7 +12,6 @@
#include "base/command_line.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/chromeos/frame/panel_browser_view.h"
-#include "chrome/browser/chromeos/options/language_config_view.h"
#include "chrome/browser/chromeos/status/status_area_view.h"
#include "chrome/browser/chromeos/status/language_menu_button.h"
#include "chrome/browser/chromeos/status/network_menu_button.h"
@@ -384,8 +383,7 @@ void BrowserView::OpenButtonOptions(const views::View* button_view) const {
if (button_view == status_area_->network_view()) {
browser()->OpenInternetOptionsDialog();
} else if (button_view == status_area_->language_view()) {
- LanguageConfigView::Show(GetProfile(),
- frame()->GetWindow()->GetNativeWindow());
+ browser()->OpenLanguageOptionsDialog();
} else {
browser()->OpenSystemOptionsDialog();
}
diff --git a/chrome/browser/gtk/first_run_bubble.cc b/chrome/browser/gtk/first_run_bubble.cc
index e169aca..c652a39 100644
--- a/chrome/browser/gtk/first_run_bubble.cc
+++ b/chrome/browser/gtk/first_run_bubble.cc
@@ -8,10 +8,12 @@
#include "app/gtk_util.h"
#include "app/l10n_util.h"
+#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
-#include "chrome/browser/options_window.h"
#include "chrome/browser/search_engines/util.h"
#include "chrome/common/notification_service.h"
#include "gfx/gtk_util.h"
@@ -171,10 +173,11 @@ void FirstRunBubble::HandleDestroy(GtkWidget* sender) {
void FirstRunBubble::HandleKeepButton(GtkWidget* sender) {
bubble_->Close();
-
}
+
void FirstRunBubble::HandleChangeButton(GtkWidget* sender) {
bubble_->Close();
- ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH,
- profile_);
+ Browser* browser = BrowserList::GetLastActive();
+ DCHECK(browser);
+ browser->OpenSearchEngineOptionsDialog();
}
diff --git a/chrome/browser/options_window.h b/chrome/browser/options_window.h
index 53292bd..be787fd 100644
--- a/chrome/browser/options_window.h
+++ b/chrome/browser/options_window.h
@@ -17,6 +17,7 @@ enum OptionsPage {
#if defined(OS_CHROMEOS)
OPTIONS_PAGE_SYSTEM,
OPTIONS_PAGE_INTERNET,
+ OPTIONS_PAGE_LANGUAGE,
#endif
OPTIONS_PAGE_GENERAL,
OPTIONS_PAGE_CONTENT,
diff --git a/chrome/browser/views/first_run_bubble.cc b/chrome/browser/views/first_run_bubble.cc
index 01457e6..0fa0893 100644
--- a/chrome/browser/views/first_run_bubble.cc
+++ b/chrome/browser/views/first_run_bubble.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/first_run/first_run.h"
-#include "chrome/browser/options_window.h"
#include "chrome/browser/search_engines/util.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "grit/chromium_strings.h"
@@ -149,10 +148,10 @@ void FirstRunBubbleView::ButtonPressed(views::Button* sender,
UserMetrics::RecordAction(
UserMetricsAction("FirstRunBubbleView_ChangeButton"),
profile_);
+
Browser* browser = BrowserList::GetLastActive();
if (browser) {
- ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH,
- browser->profile());
+ browser->OpenSearchEngineOptionsDialog();
}
}
}
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 5578981..7bd5c9d 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -114,6 +114,17 @@ const char kCloudPrintResourcesHost[] = "cloudprintresources";
const char kNetworkViewInternalsURL[] = "chrome://net-internals/";
const char kNetworkViewCacheURL[] = "chrome://view-http-cache/";
+// Option sub pages.
+const char kDefaultOptionsSubPage[] = "";
+const char kBrowserOptionsSubPage[] = "browser";
+const char kAdvancedOptionsSubPage[] = "advanced";
+const char kSearchEnginesOptionsSubPage[] = "searchEngines";
+#if defined(OS_CHROMEOS)
+const char kSystemOptionsSubPage[] = "system";
+const char kLanguageOptionsSubPage[] = "language";
+const char kInternetOptionsSubPage[] = "internet";
+#endif
+
void RegisterChromeSchemes() {
// Don't need "chrome-internal" which was used in old versions of Chrome for
// the new tab page.
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 5834b13..33feff5 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -112,6 +112,17 @@ extern const char kCloudPrintResourcesHost[];
extern const char kNetworkViewCacheURL[];
extern const char kNetworkViewInternalsURL[];
+// Options sub-pages.
+extern const char kDefaultOptionsSubPage[];
+extern const char kBrowserOptionsSubPage[];
+extern const char kAdvancedOptionsSubPage[];
+extern const char kSearchEnginesOptionsSubPage[];
+#if defined(OS_CHROMEOS)
+extern const char kSystemOptionsSubPage[];
+extern const char kLanguageOptionsSubPage[];
+extern const char kInternetOptionsSubPage[];
+#endif
+
// Call near the beginning of startup to register Chrome's internal URLs that
// should be parsed as "standard" with the googleurl library.
void RegisterChromeSchemes();