OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/privet_notifications.h" | 5 #include "chrome/browser/local_discovery/privet_notifications.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" | 12 #include "chrome/browser/local_discovery/privet_device_lister_impl.h" |
| 13 #include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h" |
| 14 #include "chrome/browser/local_discovery/service_discovery_host_client.h" |
13 #include "chrome/browser/notifications/notification.h" | 15 #include "chrome/browser/notifications/notification.h" |
| 16 #include "chrome/browser/notifications/notification_ui_manager.h" |
14 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 18 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_finder.h" | 19 #include "chrome/browser/ui/browser_finder.h" |
17 #include "chrome/browser/ui/host_desktop.h" | 20 #include "chrome/browser/ui/host_desktop.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 21 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
19 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" | 22 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
20 #include "content/public/browser/browser_context.h" | 23 #include "content/public/browser/browser_context.h" |
21 #include "content/public/browser/navigation_controller.h" | 24 #include "content/public/browser/navigation_controller.h" |
22 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
23 #include "content/public/common/page_transition_types.h" | 26 #include "content/public/common/page_transition_types.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 kPrivetNotificationIDPrefix + device_name); | 223 kPrivetNotificationIDPrefix + device_name); |
221 } | 224 } |
222 | 225 |
223 void PrivetNotificationService::Start() { | 226 void PrivetNotificationService::Start() { |
224 service_discovery_client_ = ServiceDiscoveryHostClientFactory::GetClient(); | 227 service_discovery_client_ = ServiceDiscoveryHostClientFactory::GetClient(); |
225 device_lister_.reset(new PrivetDeviceListerImpl(service_discovery_client_, | 228 device_lister_.reset(new PrivetDeviceListerImpl(service_discovery_client_, |
226 this)); | 229 this)); |
227 device_lister_->Start(); | 230 device_lister_->Start(); |
228 | 231 |
229 scoped_ptr<PrivetHTTPAsynchronousFactory> http_factory( | 232 scoped_ptr<PrivetHTTPAsynchronousFactory> http_factory( |
230 new PrivetHTTPAsynchronousFactoryImpl(service_discovery_client_.get(), | 233 PrivetHTTPAsynchronousFactory::CreateInstance( |
231 profile_->GetRequestContext())); | 234 service_discovery_client_.get(), profile_->GetRequestContext())); |
232 | 235 |
233 privet_notifications_listener_.reset(new PrivetNotificationsListener( | 236 privet_notifications_listener_.reset(new PrivetNotificationsListener( |
234 http_factory.Pass(), this)); | 237 http_factory.Pass(), this)); |
235 } | 238 } |
236 | 239 |
237 PrivetNotificationDelegate::PrivetNotificationDelegate( | 240 PrivetNotificationDelegate::PrivetNotificationDelegate( |
238 const std::string& device_id, content::BrowserContext* profile) | 241 const std::string& device_id, content::BrowserContext* profile) |
239 : device_id_(device_id), profile_(profile) { | 242 : device_id_(device_id), profile_(profile) { |
240 } | 243 } |
241 | 244 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 contents->GetController().LoadURL(url, | 285 contents->GetController().LoadURL(url, |
283 content::Referrer(), | 286 content::Referrer(), |
284 content::PAGE_TRANSITION_AUTO_TOPLEVEL, | 287 content::PAGE_TRANSITION_AUTO_TOPLEVEL, |
285 ""); | 288 ""); |
286 | 289 |
287 browser->tab_strip_model()->AppendWebContents(contents.release(), true); | 290 browser->tab_strip_model()->AppendWebContents(contents.release(), true); |
288 } | 291 } |
289 | 292 |
290 | 293 |
291 } // namespace local_discovery | 294 } // namespace local_discovery |
OLD | NEW |