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