Chromium Code Reviews| Index: chrome/browser/ui/webui/local_discovery/local_discovery_ui.cc |
| 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 f21c2b51ef25fba546f618385f8ba441222abcbc..81a8ea5ff2435222dcec5f57e5e708141135b9e3 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,16 @@ 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()); |
| + // Missing location bar probably means we came from settings in a window. |
| + // Show a back button pointing to Settings, since there's no address bar. |
| + if (browser && |
| + !browser->CanSupportWindowFeature(Browser::FEATURE_LOCATIONBAR)) { |
|
stevenjb
2014/06/18 17:40:00
You should be able to test browser->is_trusted_sou
michaelpg
2014/06/18 18:56:37
Yes, that's better.
|
| + 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 |