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/printing/cloud_print/privet_notifications.h" | 5 #include "chrome/browser/printing/cloud_print/privet_notifications.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 30 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
31 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" | 31 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
32 #include "chrome/common/chrome_switches.h" | 32 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
34 #include "chrome/grit/generated_resources.h" | 34 #include "chrome/grit/generated_resources.h" |
35 #include "components/prefs/pref_service.h" | 35 #include "components/prefs/pref_service.h" |
36 #include "components/signin/core/browser/signin_manager_base.h" | 36 #include "components/signin/core/browser/signin_manager_base.h" |
37 #include "content/public/browser/browser_context.h" | 37 #include "content/public/browser/browser_context.h" |
38 #include "content/public/browser/navigation_controller.h" | 38 #include "content/public/browser/navigation_controller.h" |
| 39 #include "content/public/browser/storage_partition.h" |
39 #include "content/public/browser/web_contents.h" | 40 #include "content/public/browser/web_contents.h" |
40 #include "grit/theme_resources.h" | 41 #include "grit/theme_resources.h" |
41 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
42 #include "ui/base/page_transition_types.h" | 43 #include "ui/base/page_transition_types.h" |
43 #include "ui/base/resource/resource_bundle.h" | 44 #include "ui/base/resource/resource_bundle.h" |
44 #include "ui/message_center/notifier_settings.h" | 45 #include "ui/message_center/notifier_settings.h" |
45 | 46 |
46 #if defined(ENABLE_MDNS) | 47 #if defined(ENABLE_MDNS) |
47 #include "chrome/browser/printing/cloud_print/privet_traffic_detector.h" | 48 #include "chrome/browser/printing/cloud_print/privet_traffic_detector.h" |
48 #endif | 49 #endif |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 #endif // ENABLE_MDNS | 338 #endif // ENABLE_MDNS |
338 service_discovery_client_ = | 339 service_discovery_client_ = |
339 local_discovery::ServiceDiscoverySharedClient::GetInstance(); | 340 local_discovery::ServiceDiscoverySharedClient::GetInstance(); |
340 device_lister_.reset( | 341 device_lister_.reset( |
341 new PrivetDeviceListerImpl(service_discovery_client_.get(), this)); | 342 new PrivetDeviceListerImpl(service_discovery_client_.get(), this)); |
342 device_lister_->Start(); | 343 device_lister_->Start(); |
343 device_lister_->DiscoverNewDevices(false); | 344 device_lister_->DiscoverNewDevices(false); |
344 | 345 |
345 std::unique_ptr<PrivetHTTPAsynchronousFactory> http_factory( | 346 std::unique_ptr<PrivetHTTPAsynchronousFactory> http_factory( |
346 PrivetHTTPAsynchronousFactory::CreateInstance( | 347 PrivetHTTPAsynchronousFactory::CreateInstance( |
347 profile_->GetRequestContext())); | 348 content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
| 349 GetURLRequestContext())); |
348 | 350 |
349 privet_notifications_listener_.reset( | 351 privet_notifications_listener_.reset( |
350 new PrivetNotificationsListener(std::move(http_factory), this)); | 352 new PrivetNotificationsListener(std::move(http_factory), this)); |
351 } | 353 } |
352 | 354 |
353 PrivetNotificationDelegate::PrivetNotificationDelegate( | 355 PrivetNotificationDelegate::PrivetNotificationDelegate( |
354 content::BrowserContext* profile) | 356 content::BrowserContext* profile) |
355 : profile_(profile) { | 357 : profile_(profile) { |
356 } | 358 } |
357 | 359 |
(...skipping 26 matching lines...) Expand all Loading... |
384 | 386 |
385 void PrivetNotificationDelegate::DisableNotifications() { | 387 void PrivetNotificationDelegate::DisableNotifications() { |
386 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 388 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
387 | 389 |
388 profile_obj->GetPrefs()->SetBoolean( | 390 profile_obj->GetPrefs()->SetBoolean( |
389 prefs::kLocalDiscoveryNotificationsEnabled, | 391 prefs::kLocalDiscoveryNotificationsEnabled, |
390 false); | 392 false); |
391 } | 393 } |
392 | 394 |
393 } // namespace cloud_print | 395 } // namespace cloud_print |
OLD | NEW |