summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormichaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 15:09:04 +0000
committermichaelpg@chromium.org <michaelpg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-19 15:09:04 +0000
commit62a03a8a3fa4ae7cfc5e95d79eacf6a8c3435ac6 (patch)
tree3e46951f7a237dacf74abab056f0fae70353c9cc /chrome
parentac793992a513fc0ea5ce25bb8acb6c7852e1ed4c (diff)
downloadchromium_src-62a03a8a3fa4ae7cfc5e95d79eacf6a8c3435ac6.zip
chromium_src-62a03a8a3fa4ae7cfc5e95d79eacf6a8c3435ac6.tar.gz
chromium_src-62a03a8a3fa4ae7cfc5e95d79eacf6a8c3435ac6.tar.bz2
Add back button to chrome://devices
When settings in a window is enabled, add a back button to the devices page. This helps because the window has no address bar. See bug for screenshot. Longer-term, the devices page should show as an overlay in Settings rather than load as a new page. RTL is not enabled for this page; see issue 386020. BUG=384333 R=noamsml@chromium.org,oshima@chromium.org +oshima@ for icon. Oshima, is theme_resources the right place for this? +stevenjb@ for browser shenanigans in local_discovery_ui.cc. Review URL: https://codereview.chromium.org/338423005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@278376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/theme/default_100_percent/common/chevron_left.pngbin0 -> 1010 bytes
-rw-r--r--chrome/app/theme/default_200_percent/common/chevron_left.pngbin0 -> 1074 bytes
-rw-r--r--chrome/app/theme/theme_resources.grd1
-rw-r--r--chrome/browser/resources/local_discovery/local_discovery.css18
-rw-r--r--chrome/browser/resources/local_discovery/local_discovery.html3
-rw-r--r--chrome/browser/resources/local_discovery/local_discovery.js7
-rw-r--r--chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc14
7 files changed, 39 insertions, 4 deletions
diff --git a/chrome/app/theme/default_100_percent/common/chevron_left.png b/chrome/app/theme/default_100_percent/common/chevron_left.png
new file mode 100644
index 0000000..90473d6
--- /dev/null
+++ b/chrome/app/theme/default_100_percent/common/chevron_left.png
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/chevron_left.png b/chrome/app/theme/default_200_percent/common/chevron_left.png
new file mode 100644
index 0000000..b5c18a2
--- /dev/null
+++ b/chrome/app/theme/default_200_percent/common/chevron_left.png
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index 801ef5d..b08f69c 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -140,6 +140,7 @@
<structure type="chrome_scaled_image" name="IDR_BROWSER_ACTIONS_OVERFLOW" file="common/browser_actions_overflow_normal.png" />
<structure type="chrome_scaled_image" name="IDR_BROWSER_ACTIONS_OVERFLOW_H" file="common/browser_actions_overflow_hover.png" />
<structure type="chrome_scaled_image" name="IDR_BROWSER_ACTIONS_OVERFLOW_P" file="common/browser_actions_overflow_pressed.png" />
+ <structure type="chrome_scaled_image" name="IDR_CHEVRON_LEFT" file="common/chevron_left.png" />
<structure type="chrome_scaled_image" name="IDR_CLOSE_BUTTON_MASK" file="common/close_button_mask.png" />
<if expr="is_win">
<structure type="chrome_scaled_image" name="IDR_CONFLICT_FAVICON" file="common/favicon_conflicts.png" />
diff --git a/chrome/browser/resources/local_discovery/local_discovery.css b/chrome/browser/resources/local_discovery/local_discovery.css
index 292a13c..bc0a332 100644
--- a/chrome/browser/resources/local_discovery/local_discovery.css
+++ b/chrome/browser/resources/local_discovery/local_discovery.css
@@ -112,4 +112,20 @@ section {
.dialog-contents {
padding-left: 17px;
-} \ No newline at end of file
+}
+
+#back-button {
+ background: url('chrome://theme/IDR_CHEVRON_LEFT') left no-repeat;
+ margin-bottom: 25px;
+ margin-top: 6px;
+ padding-left: 23px;
+}
+
+html[dir='rtl'] #back-button {
+ transform: scaleX(-1);
+}
+
+html[dir='rtl'] #back-button span {
+ display: inline-block;
+ transform: scaleX(-1);
+}
diff --git a/chrome/browser/resources/local_discovery/local_discovery.html b/chrome/browser/resources/local_discovery/local_discovery.html
index 2ef507e..267a7d2 100644
--- a/chrome/browser/resources/local_discovery/local_discovery.html
+++ b/chrome/browser/resources/local_discovery/local_discovery.html
@@ -78,6 +78,9 @@
</div>
<header>
+ <button id="back-button" class="link-button" hidden>
+ <span i18n-content="backButton"></span>
+ </button>
<h1 i18n-content="devicesTitle"></h1>
</header>
diff --git a/chrome/browser/resources/local_discovery/local_discovery.js b/chrome/browser/resources/local_discovery/local_discovery.js
index 6d2ae43..b7e265a 100644
--- a/chrome/browser/resources/local_discovery/local_discovery.js
+++ b/chrome/browser/resources/local_discovery/local_discovery.js
@@ -605,6 +605,13 @@ cr.define('local_discovery', function() {
'click',
registerOverlayLoginButtonClicked);
+ if (loadTimeData.valueExists('backButtonURL')) {
+ $('back-button').hidden = false;
+ $('back-button').addEventListener('click', function() {
+ window.location.href = loadTimeData.getString('backButtonURL');
+ });
+ }
+
updateVisibility();
document.addEventListener('visibilitychange', updateVisibility, false);
diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc
index f21c2b5..fc01fd3 100644
--- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc
+++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc
@@ -5,10 +5,13 @@
#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h"
#include "chrome/browser/ui/webui/metrics_handler.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
+#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "grit/browser_resources.h"
@@ -84,7 +87,7 @@ content::WebUIDataSource* CreateLocalDiscoveryHTMLSource() {
IDS_LOCAL_DISCOVERY_AVAILABLE_DEVICES);
source->AddLocalizedString("myDevicesTitle",
IDS_LOCAL_DISCOVERY_MY_DEVICES);
-
+ source->AddLocalizedString("backButton", IDS_SETTINGS_TITLE);
// Cloud print connector-related strings.
#if defined(ENABLE_FULL_PRINTING) && !defined(OS_CHROMEOS)
@@ -112,8 +115,13 @@ content::WebUIDataSource* CreateLocalDiscoveryHTMLSource() {
LocalDiscoveryUI::LocalDiscoveryUI(content::WebUI* web_ui)
: WebUIController(web_ui) {
// Set up the chrome://devices/ source.
- Profile* profile = Profile::FromWebUI(web_ui);
- content::WebUIDataSource::Add(profile, CreateLocalDiscoveryHTMLSource());
+ content::WebUIDataSource* source = CreateLocalDiscoveryHTMLSource();
+ Browser* browser =
+ chrome::FindBrowserWithWebContents(web_ui->GetWebContents());
+ // Show a back button pointing to Settings if the browser has no location bar.
+ if (browser && browser->is_trusted_source())
+ source->AddString("backButtonURL", chrome::kChromeUISettingsURL);
+ content::WebUIDataSource::Add(Profile::FromWebUI(web_ui), source);
// TODO(gene): Use LocalDiscoveryUIHandler to send updated to the devices
// page. For example