| OLD | NEW |
| 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/chromeos/mobile_setup_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/mobile_setup_ui.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 class MobileSetupUIHTMLSource : public content::URLDataSource { | 123 class MobileSetupUIHTMLSource : public content::URLDataSource { |
| 124 public: | 124 public: |
| 125 MobileSetupUIHTMLSource(); | 125 MobileSetupUIHTMLSource(); |
| 126 | 126 |
| 127 // content::URLDataSource implementation. | 127 // content::URLDataSource implementation. |
| 128 virtual std::string GetSource() OVERRIDE; | 128 virtual std::string GetSource() OVERRIDE; |
| 129 virtual void StartDataRequest( | 129 virtual void StartDataRequest( |
| 130 const std::string& path, | 130 const std::string& path, |
| 131 bool is_incognito, | 131 const content::URLDataSource::ExtraRequestInfo& info, |
| 132 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 132 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
| 133 virtual std::string GetMimeType(const std::string&) const OVERRIDE { | 133 virtual std::string GetMimeType(const std::string&) const OVERRIDE { |
| 134 return "text/html"; | 134 return "text/html"; |
| 135 } | 135 } |
| 136 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 136 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
| 137 return false; | 137 return false; |
| 138 } | 138 } |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 virtual ~MobileSetupUIHTMLSource() {} | 141 virtual ~MobileSetupUIHTMLSource() {} |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 MobileSetupUIHTMLSource::MobileSetupUIHTMLSource() { | 217 MobileSetupUIHTMLSource::MobileSetupUIHTMLSource() { |
| 218 } | 218 } |
| 219 | 219 |
| 220 std::string MobileSetupUIHTMLSource::GetSource() { | 220 std::string MobileSetupUIHTMLSource::GetSource() { |
| 221 return chrome::kChromeUIMobileSetupHost; | 221 return chrome::kChromeUIMobileSetupHost; |
| 222 } | 222 } |
| 223 | 223 |
| 224 void MobileSetupUIHTMLSource::StartDataRequest( | 224 void MobileSetupUIHTMLSource::StartDataRequest( |
| 225 const std::string& path, | 225 const std::string& path, |
| 226 bool is_incognito, | 226 const content::URLDataSource::ExtraRequestInfo& info, |
| 227 const content::URLDataSource::GotDataCallback& callback) { | 227 const content::URLDataSource::GotDataCallback& callback) { |
| 228 CellularNetwork* network = NULL; | 228 CellularNetwork* network = NULL; |
| 229 if (!path.empty()) { | 229 if (!path.empty()) { |
| 230 network = CrosLibrary::Get()->GetNetworkLibrary()-> | 230 network = CrosLibrary::Get()->GetNetworkLibrary()-> |
| 231 FindCellularNetworkByPath(path); | 231 FindCellularNetworkByPath(path); |
| 232 } | 232 } |
| 233 | 233 |
| 234 if (!network || (!network->SupportsActivation() && !network->activated())) { | 234 if (!network || (!network->SupportsActivation() && !network->activated())) { |
| 235 LOG(WARNING) << "Can't find device to activate for service path " << path; | 235 LOG(WARNING) << "Can't find device to activate for service path " << path; |
| 236 scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes); | 236 scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 506 |
| 507 // Set up the chrome://mobilesetup/ source. | 507 // Set up the chrome://mobilesetup/ source. |
| 508 Profile* profile = Profile::FromWebUI(web_ui); | 508 Profile* profile = Profile::FromWebUI(web_ui); |
| 509 content::URLDataSource::Add(profile, html_source); | 509 content::URLDataSource::Add(profile, html_source); |
| 510 } | 510 } |
| 511 | 511 |
| 512 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { | 512 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { |
| 513 // Destroyed by the corresponding RenderViewHost | 513 // Destroyed by the corresponding RenderViewHost |
| 514 new PortalFrameLoadObserver(AsWeakPtr(), host); | 514 new PortalFrameLoadObserver(AsWeakPtr(), host); |
| 515 } | 515 } |
| OLD | NEW |