| 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 int render_process_id, |
| 132 int render_view_id, |
| 132 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; | 133 const content::URLDataSource::GotDataCallback& callback) OVERRIDE; |
| 133 virtual std::string GetMimeType(const std::string&) const OVERRIDE { | 134 virtual std::string GetMimeType(const std::string&) const OVERRIDE { |
| 134 return "text/html"; | 135 return "text/html"; |
| 135 } | 136 } |
| 136 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { | 137 virtual bool ShouldAddContentSecurityPolicy() const OVERRIDE { |
| 137 return false; | 138 return false; |
| 138 } | 139 } |
| 139 | 140 |
| 140 private: | 141 private: |
| 141 virtual ~MobileSetupUIHTMLSource() {} | 142 virtual ~MobileSetupUIHTMLSource() {} |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 MobileSetupUIHTMLSource::MobileSetupUIHTMLSource() { | 218 MobileSetupUIHTMLSource::MobileSetupUIHTMLSource() { |
| 218 } | 219 } |
| 219 | 220 |
| 220 std::string MobileSetupUIHTMLSource::GetSource() { | 221 std::string MobileSetupUIHTMLSource::GetSource() { |
| 221 return chrome::kChromeUIMobileSetupHost; | 222 return chrome::kChromeUIMobileSetupHost; |
| 222 } | 223 } |
| 223 | 224 |
| 224 void MobileSetupUIHTMLSource::StartDataRequest( | 225 void MobileSetupUIHTMLSource::StartDataRequest( |
| 225 const std::string& path, | 226 const std::string& path, |
| 226 bool is_incognito, | 227 int render_process_id, |
| 228 int render_view_id, |
| 227 const content::URLDataSource::GotDataCallback& callback) { | 229 const content::URLDataSource::GotDataCallback& callback) { |
| 228 CellularNetwork* network = NULL; | 230 CellularNetwork* network = NULL; |
| 229 if (!path.empty()) { | 231 if (!path.empty()) { |
| 230 network = CrosLibrary::Get()->GetNetworkLibrary()-> | 232 network = CrosLibrary::Get()->GetNetworkLibrary()-> |
| 231 FindCellularNetworkByPath(path); | 233 FindCellularNetworkByPath(path); |
| 232 } | 234 } |
| 233 | 235 |
| 234 if (!network || (!network->SupportsActivation() && !network->activated())) { | 236 if (!network || (!network->SupportsActivation() && !network->activated())) { |
| 235 LOG(WARNING) << "Can't find device to activate for service path " << path; | 237 LOG(WARNING) << "Can't find device to activate for service path " << path; |
| 236 scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes); | 238 scoped_refptr<base::RefCountedBytes> html_bytes(new base::RefCountedBytes); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 | 508 |
| 507 // Set up the chrome://mobilesetup/ source. | 509 // Set up the chrome://mobilesetup/ source. |
| 508 Profile* profile = Profile::FromWebUI(web_ui); | 510 Profile* profile = Profile::FromWebUI(web_ui); |
| 509 content::URLDataSource::Add(profile, html_source); | 511 content::URLDataSource::Add(profile, html_source); |
| 510 } | 512 } |
| 511 | 513 |
| 512 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { | 514 void MobileSetupUI::RenderViewCreated(RenderViewHost* host) { |
| 513 // Destroyed by the corresponding RenderViewHost | 515 // Destroyed by the corresponding RenderViewHost |
| 514 new PortalFrameLoadObserver(AsWeakPtr(), host); | 516 new PortalFrameLoadObserver(AsWeakPtr(), host); |
| 515 } | 517 } |
| OLD | NEW |