OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/devtools/device/webrtc/devtools_bridge_client.h" | 5 #include "chrome/browser/devtools/device/webrtc/devtools_bridge_client.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/local_discovery/gcd_api_flow.h" | 9 #include "chrome/browser/local_discovery/gcd_api_flow.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
11 #include "components/signin/core/browser/profile_identity_provider.h" | 11 #include "components/signin/core/browser/profile_identity_provider.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
15 #include "content/public/browser/web_contents.h" | 15 #include "content/public/browser/web_contents.h" |
16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 17 #include "content/public/browser/web_contents_source.h" |
17 #include "content/public/browser/web_contents_user_data.h" | 18 #include "content/public/browser/web_contents_user_data.h" |
18 #include "ui/base/page_transition_types.h" | 19 #include "ui/base/page_transition_types.h" |
19 | 20 |
20 using content::BrowserThread; | 21 using content::BrowserThread; |
21 using content::WebContents; | 22 using content::WebContents; |
22 | 23 |
23 namespace { | 24 namespace { |
24 | 25 |
25 const char kBackgroundWorkerURL[] = | 26 const char kBackgroundWorkerURL[] = |
26 "chrome://webrtc-device-provider/background_worker.html"; | 27 "chrome://webrtc-device-provider/background_worker.html"; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 result.browser_info = self->browsers_; | 177 result.browser_info = self->browsers_; |
177 } | 178 } |
178 return result; | 179 return result; |
179 } | 180 } |
180 | 181 |
181 void DevToolsBridgeClient::CreateBackgroundWorker() { | 182 void DevToolsBridgeClient::CreateBackgroundWorker() { |
182 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 183 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
183 | 184 |
184 background_worker_.reset( | 185 background_worker_.reset( |
185 WebContents::Create(WebContents::CreateParams(profile_))); | 186 WebContents::Create(WebContents::CreateParams(profile_))); |
186 | 187 WebContentsSource::CreateForWebContentsAndLocation(background_worker_.get(), |
| 188 FROM_HERE); |
187 BackgroundWorkerUserData::CreateForWebContents(background_worker_.get()); | 189 BackgroundWorkerUserData::CreateForWebContents(background_worker_.get()); |
188 BackgroundWorkerUserData::FromWebContents(background_worker_.get()) | 190 BackgroundWorkerUserData::FromWebContents(background_worker_.get()) |
189 ->SetClient(this); | 191 ->SetClient(this); |
190 WebContentsObserver::Observe(background_worker_.get()); | 192 WebContentsObserver::Observe(background_worker_.get()); |
191 | 193 |
192 GURL url(kBackgroundWorkerURL); | 194 GURL url(kBackgroundWorkerURL); |
193 DCHECK_EQ(chrome::kChromeUIWebRTCDeviceProviderHost, url.host()); | 195 DCHECK_EQ(chrome::kChromeUIWebRTCDeviceProviderHost, url.host()); |
194 | 196 |
195 background_worker_->GetController().LoadURL(url, content::Referrer(), | 197 background_worker_->GetController().LoadURL(url, content::Referrer(), |
196 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, | 198 ui::PAGE_TRANSITION_AUTO_TOPLEVEL, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 | 258 |
257 browser_list_request_.reset(); | 259 browser_list_request_.reset(); |
258 | 260 |
259 OnBrowserListUpdatedForTests(); | 261 OnBrowserListUpdatedForTests(); |
260 } | 262 } |
261 | 263 |
262 void DevToolsBridgeClient::OnDevToolsBridgeInstancesRequestFailed() { | 264 void DevToolsBridgeClient::OnDevToolsBridgeInstancesRequestFailed() { |
263 // We keep the list of remote browsers even if the request failed. | 265 // We keep the list of remote browsers even if the request failed. |
264 browser_list_request_.reset(); | 266 browser_list_request_.reset(); |
265 } | 267 } |
OLD | NEW |