summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 18:17:50 +0000
committercsilv@chromium.org <csilv@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-19 18:17:50 +0000
commit0f4758f7f597d5f4b608f75aba2cec316d1b62b8 (patch)
treec37e35a14dd8eef3c1926f6e3cbeb0da75878e66
parent5bd68b134707a0bdc0aaab829f74fa538393cf3e (diff)
downloadchromium_src-0f4758f7f597d5f4b608f75aba2cec316d1b62b8.zip
chromium_src-0f4758f7f597d5f4b608f75aba2cec316d1b62b8.tar.gz
chromium_src-0f4758f7f597d5f4b608f75aba2cec316d1b62b8.tar.bz2
dom-ui settings: Add search field and search page elements. Search capability TBD.
BUG=59267 TEST=manual Review URL: http://codereview.chromium.org/5234001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66783 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd17
-rw-r--r--chrome/browser/dom_ui/options/core_options_handler.cc21
-rw-r--r--chrome/browser/resources/options.html10
-rw-r--r--chrome/browser/resources/options/search_page.html13
-rw-r--r--chrome/browser/resources/options/search_page.js59
-rw-r--r--chrome/common/url_constants.cc9
-rw-r--r--chrome/common/url_constants.h3
7 files changed, 130 insertions, 2 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 8c9cd49..90e18f5 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -7049,6 +7049,23 @@ Keep your key file in a safe place. You will need it to create new versions of y
Some options have been disabled by your IT administrator.
</message>
+ <!-- Options search page strings. -->
+ <message name="IDS_OPTIONS_SEARCH_PAGE_TITLE" desc="">
+ Search
+ </message>
+ <message name="IDS_OPTIONS_SEARCH_PAGE_INFO" desc="">
+ Type to search <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> settings.
+ </message>
+ <message name="IDS_OPTIONS_SEARCH_PAGE_NO_MATCHES" desc="">
+ No matches were found.
+ </message>
+ <message name="IDS_OPTIONS_SEARCH_PAGE_HELP_LABEL" desc="">
+ Can't find what you're looking for?
+ </message>
+ <message name="IDS_OPTIONS_SEARCH_PAGE_HELP_TITLE" desc="">
+ <ph name="PRODUCT_NAME">$1<ex>Google Chrome</ex></ph> Help
+ </message>
+
<!-- Misc advanced option description strings. -->
<message name="IDS_NETWORK_DNS_PREFETCH_ENABLED_DESCRIPTION" desc="In the advanced options tab, the text next to the checkbox that enables DNS prefetching. DNS prefetching involves scanning pages and user text entries, guessing what domain the user may next navigate to, and obtaining the domain's DNS information for that URL in advance. ">
Use DNS pre-fetching to improve page load performance
diff --git a/chrome/browser/dom_ui/options/core_options_handler.cc b/chrome/browser/dom_ui/options/core_options_handler.cc
index aabd3f4..951b7d8 100644
--- a/chrome/browser/dom_ui/options/core_options_handler.cc
+++ b/chrome/browser/dom_ui/options/core_options_handler.cc
@@ -9,11 +9,14 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/google/google_util.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profile.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
+#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -55,6 +58,24 @@ void CoreOptionsHandler::GetLocalizedValues(
localized_strings->SetString("managedPrefsBannerText",
l10n_util::GetStringUTF16(IDS_OPTIONS_MANAGED_PREFS));
+ // Search
+ localized_strings->SetString("searchPageTitle",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PAGE_TITLE));
+ localized_strings->SetString("searchPageInfo",
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_SEARCH_PAGE_INFO,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+ localized_strings->SetString("searchPageNoMatches",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PAGE_NO_MATCHES));
+ localized_strings->SetString("searchPageHelpLabel",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SEARCH_PAGE_HELP_LABEL));
+ localized_strings->SetString("searchPageHelpTitle",
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_SEARCH_PAGE_HELP_TITLE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+ localized_strings->SetString("searchPageHelpURL",
+ google_util::AppendGoogleLocaleParam(
+ GURL(chrome::kChromeHelpURL)).spec());
+
+ // Common
localized_strings->SetString("ok",
l10n_util::GetStringUTF16(IDS_OK));
localized_strings->SetString("cancel",
diff --git a/chrome/browser/resources/options.html b/chrome/browser/resources/options.html
index 4efe084..3a51d56 100644
--- a/chrome/browser/resources/options.html
+++ b/chrome/browser/resources/options.html
@@ -123,6 +123,7 @@
<script src="options/personal_options.js"></script>
<script src="options/search_engine_manager.js"></script>
<script src="options/search_engine_manager_engine_list.js"></script>
+<script src="options/search_page.js"></script>
<script src="options/sync_options.js"></script>
<script src="options/zippy.js"></script>
<script>
@@ -146,6 +147,7 @@ var PasswordsExceptions = options.PasswordsExceptions;
var PersonalOptions = options.PersonalOptions;
var Preferences = options.Preferences;
var SearchEngineManager = options.SearchEngineManager;
+var SearchPage = options.SearchPage;
var ProxyOptions = options.ProxyOptions;
var SyncOptions = options.SyncOptions;
@@ -190,6 +192,7 @@ function load() {
OptionsPage.register(InternetOptions.getInstance());
}
+ OptionsPage.register(SearchPage.getInstance());
OptionsPage.register(BrowserOptions.getInstance());
OptionsPage.registerSubPage(SearchEngineManager.getInstance(),
BrowserOptions.getInstance());
@@ -324,14 +327,19 @@ window.onpopstate = function(e) {
i18n-content="managedPrefsBannerText"></span>
</div>
<div id="mainview-content">
+ <!-- Start main pages -->
+ <!-- Please keep the main pages in desired order of display. This will
+ allow search results to display in the desired order. -->
<if expr="pp_ifdef('chromeos')">
<include src="options/chromeos_system_options.html">
<include src="options/chromeos_internet_options.html">
<include src="options/chromeos_accounts_options.html">
</if>
- <include src="options/advanced_options.html">
+ <include src="options/search_page.html">
<include src="options/browser_options.html">
<include src="options/personal_options.html">
+ <include src="options/advanced_options.html">
+ <!-- End main pages -->
<div id="subpage-sheet-container" class="hidden">
<div id="subpage-sheet">
<if expr="pp_ifdef('chromeos')">
diff --git a/chrome/browser/resources/options/search_page.html b/chrome/browser/resources/options/search_page.html
new file mode 100644
index 0000000..413ce56
--- /dev/null
+++ b/chrome/browser/resources/options/search_page.html
@@ -0,0 +1,13 @@
+<div id="searchPage" class="page">
+ <h1 i18n-content="searchPageTitle"></h1>
+ <div id="searchPageInfo">
+ <p i18n-content="searchPageInfo"></p>
+ </div>
+ <div id="searchPageNoMatches" class="hidden">
+ <p i18n-content="searchPageNoMatches"></p>
+ <p><span i18n-content="searchPageHelpLabel"></span>
+ <a target=_blank" i18n-content="searchPageHelpTitle"
+ i18n-values="href:searchPageHelpURL"></a>
+ </p>
+ </div>
+</div>
diff --git a/chrome/browser/resources/options/search_page.js b/chrome/browser/resources/options/search_page.js
new file mode 100644
index 0000000..1951f8f
--- /dev/null
+++ b/chrome/browser/resources/options/search_page.js
@@ -0,0 +1,59 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('options', function() {
+ const OptionsPage = options.OptionsPage;
+
+ /**
+ * Encapsulated handling of the search page.
+ */
+ function SearchPage() {
+ OptionsPage.call(this, 'search', templateData.searchPage, 'searchPage');
+ }
+
+ cr.addSingletonGetter(SearchPage);
+
+ SearchPage.prototype = {
+ // Inherit SearchPage from OptionsPage.
+ __proto__: OptionsPage.prototype,
+
+ // Initialize SearchPage.
+ initializePage: function() {
+ // Call base class implementation to start preference initialization.
+ OptionsPage.prototype.initializePage.call(this);
+
+ // Create a search field element.
+ var searchField = document.createElement('input');
+ searchField.id = 'searchField';
+ searchField.type = 'search';
+ searchField.setAttribute('autosave', 'org.chromium.options.search');
+ searchField.setAttribute('results', '10');
+
+ // Replace the contents of the navigation tab with the search field.
+ this.tab.textContent = '';
+ this.tab.appendChild(searchField);
+ },
+ };
+
+ SearchPage.updateForEmptySearch = function() {
+ $('searchPageInfo').classList.remove('hidden');
+ $('searchPageNoMatches').classList.add('hidden');
+ };
+
+ SearchPage.updateForNoSearchResults = function(message) {
+ $('searchPageInfo').classList.add('hidden');
+ $('searchPageNoMatches').classList.remove('hidden');
+ };
+
+ SearchPage.updateForSuccessfulSearch = function(enable) {
+ $('searchPageInfo').classList.add('hidden');
+ $('searchPageNoMatches').classList.add('hidden');
+ };
+
+ // Export
+ return {
+ SearchPage: SearchPage
+ };
+
+});
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 554b5ba..0345d6d 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -174,7 +174,14 @@ const char kLanguageOptionsSubPage[] = "language";
const char kSystemOptionsSubPage[] = "system";
#endif
-const char kPageInfoHelpCenterURL[] =
+const char kChromeHelpURL[] =
+#if defined(OS_CHROMEOS)
+ "http://www.google.com/support/chromeos/";
+#else
+ "http://www.google.com/support/chrome/";
+#endif
+
+ const char kPageInfoHelpCenterURL[] =
#if defined(OS_CHROMEOS)
"http://www.google.com/support/chromeos/bin/answer.py?answer=95617";
#else
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 14c2b37..e617178 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -170,6 +170,9 @@ extern const char kLanguageOptionsSubPage[];
extern const char kSystemOptionsSubPage[];
#endif
+// General help link for Chrome.
+extern const char kChromeHelpURL[];
+
// "What do these mean?" URL for the Page Info bubble.
extern const char kPageInfoHelpCenterURL[];