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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 #include "chrome/browser/ui/host_desktop.h" | 25 #include "chrome/browser/ui/host_desktop.h" |
26 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 26 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
27 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" | 27 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" |
28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
30 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
31 #include "components/signin/core/browser/signin_manager_base.h" | 31 #include "components/signin/core/browser/signin_manager_base.h" |
32 #include "content/public/browser/browser_context.h" | 32 #include "content/public/browser/browser_context.h" |
33 #include "content/public/browser/navigation_controller.h" | 33 #include "content/public/browser/navigation_controller.h" |
34 #include "content/public/browser/web_contents.h" | 34 #include "content/public/browser/web_contents.h" |
35 #include "content/public/common/page_transition_types.h" | |
36 #include "grit/theme_resources.h" | 35 #include "grit/theme_resources.h" |
37 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
| 37 #include "ui/base/page_transition_types.h" |
38 #include "ui/base/resource/resource_bundle.h" | 38 #include "ui/base/resource/resource_bundle.h" |
39 #include "ui/message_center/notifier_settings.h" | 39 #include "ui/message_center/notifier_settings.h" |
40 | 40 |
41 #if defined(ENABLE_MDNS) | 41 #if defined(ENABLE_MDNS) |
42 #include "chrome/browser/local_discovery/privet_traffic_detector.h" | 42 #include "chrome/browser/local_discovery/privet_traffic_detector.h" |
43 #endif | 43 #endif |
44 | 44 |
45 namespace local_discovery { | 45 namespace local_discovery { |
46 | 46 |
47 namespace { | 47 namespace { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 ReportPrivetUmaEvent(PRIVET_DISABLE_NOTIFICATIONS_CLICKED); | 393 ReportPrivetUmaEvent(PRIVET_DISABLE_NOTIFICATIONS_CLICKED); |
394 DisableNotifications(); | 394 DisableNotifications(); |
395 } | 395 } |
396 } | 396 } |
397 | 397 |
398 void PrivetNotificationDelegate::OpenTab(const GURL& url) { | 398 void PrivetNotificationDelegate::OpenTab(const GURL& url) { |
399 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 399 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
400 | 400 |
401 chrome::NavigateParams params(profile_obj, | 401 chrome::NavigateParams params(profile_obj, |
402 url, | 402 url, |
403 content::PAGE_TRANSITION_AUTO_TOPLEVEL); | 403 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
404 params.disposition = NEW_FOREGROUND_TAB; | 404 params.disposition = NEW_FOREGROUND_TAB; |
405 chrome::Navigate(¶ms); | 405 chrome::Navigate(¶ms); |
406 } | 406 } |
407 | 407 |
408 void PrivetNotificationDelegate::DisableNotifications() { | 408 void PrivetNotificationDelegate::DisableNotifications() { |
409 Profile* profile_obj = Profile::FromBrowserContext(profile_); | 409 Profile* profile_obj = Profile::FromBrowserContext(profile_); |
410 | 410 |
411 profile_obj->GetPrefs()->SetBoolean( | 411 profile_obj->GetPrefs()->SetBoolean( |
412 prefs::kLocalDiscoveryNotificationsEnabled, | 412 prefs::kLocalDiscoveryNotificationsEnabled, |
413 false); | 413 false); |
414 } | 414 } |
415 | 415 |
416 } // namespace local_discovery | 416 } // namespace local_discovery |
OLD | NEW |