diff options
12 files changed, 114 insertions, 8 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 0342a3a..300fb80 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -8112,6 +8112,9 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr <message name="IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON" desc="The label of the 'Show Home button' checkbox"> Show Home button </message> + <message name="IDS_OPTIONS_CHANGE_HOME_PAGE" desc="The text of the button that allows the user to change her home page"> + Change page + </message> <message name="IDS_OPTIONS_SHOW_HOME_BUTTON_FOR_URL" desc="The label of the 'Show Home button' checkbox"> Show Home button for <b><ph name="HOME_PAGE_URL">$1<ex>google.com/search</ex></ph></b>. </message> diff --git a/chrome/browser/resources/options2/browser_options.html b/chrome/browser/resources/options2/browser_options.html index 0e47002..0afd08c 100644 --- a/chrome/browser/resources/options2/browser_options.html +++ b/chrome/browser/resources/options2/browser_options.html @@ -61,12 +61,13 @@ <h3 i18n-content="toolbarGroupName"></h3> <div> <div class="checkbox"> - <label> - <input id="toolbarShowHomeButton" pref="browser.show_home_button" - metric="Options_Homepage_HomeButton" type="checkbox"> - <span id="home-page-label" i18n-content="toolbarShowHomeButton"> - </span> + <input id="toolbarShowHomeButton" pref="browser.show_home_button" + metric="Options_Homepage_HomeButton" type="checkbox"> + <label id="home-page-label" for="toolbarShowHomeButton" + i18n-content="toolbarShowHomeButton"> </label> + <button id="change-home-page" i18n-content="changeHomePage" + class="link-button custom-appearance"></button> </div> <div class="checkbox"> <label> diff --git a/chrome/browser/resources/options2/browser_options.js b/chrome/browser/resources/options2/browser_options.js index dab7645..248f038 100644 --- a/chrome/browser/resources/options2/browser_options.js +++ b/chrome/browser/resources/options2/browser_options.js @@ -73,6 +73,9 @@ cr.define('options', function() { ['Options_OpenUnderTheHood']); }; $('defaultSearchEngine').onchange = this.setDefaultSearchEngine_; + $('change-home-page').onclick = function(event) { + OptionsPage.navigateToPage('homePageOverlay'); + }; var self = this; $('instantEnabledCheckbox').customChangeHandler = function(event) { diff --git a/chrome/browser/resources/options2/browser_options_page.css b/chrome/browser/resources/options2/browser_options_page.css index 342854c..4cbcc6b 100644 --- a/chrome/browser/resources/options2/browser_options_page.css +++ b/chrome/browser/resources/options2/browser_options_page.css @@ -1,3 +1,11 @@ +/* This is necessary because the fix for correctly wrapping labels + * (crbug.com/109334) requires labels to be display: block; however, this label + * has a buttom inline after it. + */ +#home-page-label { + display: inline; +} + #defaultSearchEngineGroup { display: -webkit-box; -webkit-box-orient: vertical; diff --git a/chrome/browser/resources/options2/home_page_overlay.html b/chrome/browser/resources/options2/home_page_overlay.html new file mode 100644 index 0000000..7bf8dcf --- /dev/null +++ b/chrome/browser/resources/options2/home_page_overlay.html @@ -0,0 +1,12 @@ +<div id="home-page-overlay" class="page" hidden> + <h1 i18n-content="homePageTitle"></h1> + <div class="content-area"> + </div> + <div class="action-area"> + <div class="button-strip"> + <button id="home-page-cancel" type="reset" i18n-content="cancel"> + </button> + <button id="home-page-confirm" type="submit" i18n-content="ok"></button> + </div> + </div> +</div> diff --git a/chrome/browser/resources/options2/home_page_overlay.js b/chrome/browser/resources/options2/home_page_overlay.js new file mode 100644 index 0000000..b5bf3bc --- /dev/null +++ b/chrome/browser/resources/options2/home_page_overlay.js @@ -0,0 +1,54 @@ +// Copyright (c) 2012 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() { + var OptionsPage = options.OptionsPage; + + /** + * HomePageOverlay class + * Dialog that allows users to set the home page. + * @class + */ + function HomePageOverlay() { + OptionsPage.call(this, 'homePageOverlay', '', 'home-page-overlay'); + } + + cr.addSingletonGetter(HomePageOverlay); + + HomePageOverlay.prototype = { + // Inherit HomePageOverlay from OptionsPage. + __proto__: OptionsPage.prototype, + + /** + * Initialize the page. + */ + initializePage: function() { + // Call base class implementation to start preference initialization. + OptionsPage.prototype.initializePage.call(this); + + var self = this; + $('home-page-confirm').onclick = function(event) { + self.handleCancel_(); + }; + + $('home-page-cancel').onclick = function(event) { + self.handleCancel_(); + }; + }, + + /** + * Handles the cancel button by closing the overlay. + * @private + */ + handleCancel_: function() { + OptionsPage.closeOverlay(); + }, + + }; + + // Export + return { + HomePageOverlay: HomePageOverlay + }; +}); diff --git a/chrome/browser/resources/options2/options.html b/chrome/browser/resources/options2/options.html index ea4ec8c..993b785 100644 --- a/chrome/browser/resources/options2/options.html +++ b/chrome/browser/resources/options2/options.html @@ -84,6 +84,7 @@ <include src="autofill_edit_address_overlay.html"> <include src="autofill_edit_creditcard_overlay.html"> <include src="clear_browser_data_overlay.html"> + <include src="home_page_overlay.html"> <include src="import_data_overlay.html"> <include src="instant_confirm_overlay.html"> <include src="language_add_language_overlay.html"> diff --git a/chrome/browser/resources/options2/options.js b/chrome/browser/resources/options2/options.js index b8e3d7e..ca46505 100644 --- a/chrome/browser/resources/options2/options.js +++ b/chrome/browser/resources/options2/options.js @@ -16,6 +16,7 @@ var ContentSettingsExceptionsArea = var CookiesView = options.CookiesView; var FontSettings = options.FontSettings; var HandlerOptions = options.HandlerOptions; +var HomePageOverlay = options.HomePageOverlay; var ImportDataOverlay = options.ImportDataOverlay; var IntentsView = options.IntentsView; var InstantConfirmOverlay = options.InstantConfirmOverlay; @@ -165,6 +166,9 @@ function load() { OptionsPage.registerOverlay(ClearBrowserDataOverlay.getInstance(), AdvancedOptions.getInstance(), [$('privacyClearDataButton')]); + OptionsPage.registerOverlay(HomePageOverlay.getInstance(), + BrowserOptions.getInstance(), + [$('toolbarShowHomeButton')]); OptionsPage.registerOverlay(ImportDataOverlay.getInstance(), PersonalOptions.getInstance()); OptionsPage.registerOverlay(InstantConfirmOverlay.getInstance(), diff --git a/chrome/browser/resources/options2/options_bundle.js b/chrome/browser/resources/options2/options_bundle.js index 6f1d13e..46d717a 100644 --- a/chrome/browser/resources/options2/options_bundle.js +++ b/chrome/browser/resources/options2/options_bundle.js @@ -73,6 +73,7 @@ <include src="handler_options.js"></script> <include src="handler_options_list.js"></script> </if> +<include src="home_page_overlay.js"></include> <include src="import_data_overlay.js"></include> <include src="instant_confirm_overlay.js"></include> <if expr="pp_ifdef('enable_web_intents')"> diff --git a/chrome/browser/resources/options2/options_page.css b/chrome/browser/resources/options2/options_page.css index 6e306f4..3dc1183 100644 --- a/chrome/browser/resources/options2/options_page.css +++ b/chrome/browser/resources/options2/options_page.css @@ -38,6 +38,21 @@ div.disabled { color: #888; } +/* TODO(jhawkins): Refactor back into button.css once more pages are converted. + */ +.link-button { + color: #303942; + padding-left: 0; + padding-right: 0; +} + +/* TODO(jhawkins): Get color values for these states. */ +.link-button:focus, +.link-button:hover, +.link-button:active { + color: #303942; +} + /* TEXT */ input[type='password'], input[type='text'], diff --git a/chrome/browser/resources/shared/css/checkbox.css b/chrome/browser/resources/shared/css/checkbox.css index 57e03d1..b441be3 100644 --- a/chrome/browser/resources/shared/css/checkbox.css +++ b/chrome/browser/resources/shared/css/checkbox.css @@ -151,16 +151,19 @@ input[type='radio']:not(.custom-appearance):focus { } label > input[type=radio] ~ span, -label > input[type=checkbox] ~ span { +label > input[type=checkbox] ~ span, +input[type=checkbox] ~ label { color: #444; } label:hover > input[type=checkbox]:disabled ~ span, -label:hover > input[type=radio]:disabled ~ span { +label:hover > input[type=radio]:disabled ~ span, +input[type=checkbox]:disabled ~ label:hover { color: #888; } label:hover > input[type=checkbox]:not(:disabled) ~ span, -label:hover > input[type=radio]:not(:disabled) ~ span { +label:hover > input[type=radio]:not(:disabled) ~ span, +input[type=checkbox]:not(:disabled) ~ label:hover { color: #222; } diff --git a/chrome/browser/ui/webui/options2/browser_options_handler2.cc b/chrome/browser/ui/webui/options2/browser_options_handler2.cc index ef0d15c..49fc8b0 100644 --- a/chrome/browser/ui/webui/options2/browser_options_handler2.cc +++ b/chrome/browser/ui/webui/options2/browser_options_handler2.cc @@ -104,6 +104,7 @@ void BrowserOptionsHandler::GetLocalizedValues( { "startupSetPages", IDS_OPTIONS2_STARTUP_SET_PAGES }, { "toolbarGroupName", IDS_OPTIONS2_TOOLBAR_GROUP_NAME }, { "toolbarShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON }, + { "changeHomePage", IDS_OPTIONS_CHANGE_HOME_PAGE }, { "toolbarShowBookmarksBar", IDS_OPTIONS_TOOLBAR_SHOW_BOOKMARKS_BAR }, { "defaultSearchGroupName", IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME }, { "defaultSearchManageEngines", IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES }, |