Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: chrome/browser/ui/webui/uber/uber_ui.cc

Issue 23567023: Enable Device Discovery by default on Linux, ChromeOS and Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/uber/uber_ui.h" 5 #include "chrome/browser/ui/webui/uber/uber_ui.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 IDS_LOCAL_DISCOVERY_DEVICES_PAGE_TITLE); 126 IDS_LOCAL_DISCOVERY_DEVICES_PAGE_TITLE);
127 bool overridesHistory = HasExtensionType(profile, 127 bool overridesHistory = HasExtensionType(profile,
128 chrome::kChromeUIHistoryHost); 128 chrome::kChromeUIHistoryHost);
129 source->AddString("overridesHistory", 129 source->AddString("overridesHistory",
130 ASCIIToUTF16(overridesHistory ? "yes" : "no")); 130 ASCIIToUTF16(overridesHistory ? "yes" : "no"));
131 source->DisableDenyXFrameOptions(); 131 source->DisableDenyXFrameOptions();
132 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;"); 132 source->OverrideContentSecurityPolicyFrameSrc("frame-src chrome:;");
133 133
134 bool devicesHidden = true; 134 bool devicesHidden = true;
135 #if defined(ENABLE_MDNS) 135 #if defined(ENABLE_MDNS)
136 if (CommandLine::ForCurrentProcess()->HasSwitch( 136 if (!CommandLine::ForCurrentProcess()->HasSwitch(
137 switches::kEnableDeviceDiscovery)) { 137 switches::kDisableDeviceDiscovery)) {
138 devicesHidden = false; 138 devicesHidden = false;
139 } 139 }
140 #endif 140 #endif
141 source->AddBoolean("devicesHidden", devicesHidden); 141 source->AddBoolean("devicesHidden", devicesHidden);
142 142
143 return source; 143 return source;
144 } 144 }
145 145
146 } // namespace 146 } // namespace
147 147
148 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) { 148 UberUI::UberUI(content::WebUI* web_ui) : WebUIController(web_ui) {
149 Profile* profile = Profile::FromWebUI(web_ui); 149 Profile* profile = Profile::FromWebUI(web_ui);
150 content::WebUIDataSource::Add(profile, CreateUberHTMLSource()); 150 content::WebUIDataSource::Add(profile, CreateUberHTMLSource());
151 151
152 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL); 152 RegisterSubpage(chrome::kChromeUIExtensionsFrameURL);
153 RegisterSubpage(chrome::kChromeUIHelpFrameURL); 153 RegisterSubpage(chrome::kChromeUIHelpFrameURL);
154 RegisterSubpage(chrome::kChromeUIHistoryFrameURL); 154 RegisterSubpage(chrome::kChromeUIHistoryFrameURL);
155 RegisterSubpage(chrome::kChromeUISettingsFrameURL); 155 RegisterSubpage(chrome::kChromeUISettingsFrameURL);
156 RegisterSubpage(chrome::kChromeUIUberFrameURL); 156 RegisterSubpage(chrome::kChromeUIUberFrameURL);
157 157
158 #if defined(ENABLE_MDNS) 158 #if defined(ENABLE_MDNS)
159 if (CommandLine::ForCurrentProcess()->HasSwitch( 159 if (!CommandLine::ForCurrentProcess()->HasSwitch(
160 switches::kEnableDeviceDiscovery)) { 160 switches::kDisableDeviceDiscovery)) {
161 RegisterSubpage(chrome::kChromeUIDevicesFrameURL); 161 RegisterSubpage(chrome::kChromeUIDevicesFrameURL);
162 } 162 }
163 #endif 163 #endif
164 } 164 }
165 165
166 UberUI::~UberUI() { 166 UberUI::~UberUI() {
167 STLDeleteValues(&sub_uis_); 167 STLDeleteValues(&sub_uis_);
168 } 168 }
169 169
170 void UberUI::RegisterSubpage(const std::string& page_url) { 170 void UberUI::RegisterSubpage(const std::string& page_url) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 web_ui()->CallJavascriptFunction( 241 web_ui()->CallJavascriptFunction(
242 "uber_frame.setNavigationOverride", 242 "uber_frame.setNavigationOverride",
243 base::StringValue(chrome::kChromeUIHistoryHost), 243 base::StringValue(chrome::kChromeUIHistoryHost),
244 base::StringValue(overrides_history ? "yes" : "no")); 244 base::StringValue(overrides_history ? "yes" : "no"));
245 break; 245 break;
246 } 246 }
247 default: 247 default:
248 NOTREACHED(); 248 NOTREACHED();
249 } 249 }
250 } 250 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698