OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/network_message_observer.h" | 5 #include "chrome/browser/chromeos/network_message_observer.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "ash/system/chromeos/network/network_observer.h" | 9 #include "ash/system/chromeos/network/network_observer.h" |
10 #include "ash/system/tray/system_tray.h" | 10 #include "ash/system/tray/system_tray.h" |
| 11 #include "ash/system/tray/system_tray_delegate.h" |
| 12 #include "ash/system/tray/system_tray_observers.h" |
11 #include "base/bind.h" | 13 #include "base/bind.h" |
12 #include "base/callback.h" | 14 #include "base/callback.h" |
13 #include "base/stl_util.h" | 15 #include "base/stl_util.h" |
14 #include "base/string_number_conversions.h" | 16 #include "base/string_number_conversions.h" |
15 #include "base/utf_string_conversions.h" | 17 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/chromeos/cros/cros_library.h" | 18 #include "chrome/browser/chromeos/cros/cros_library.h" |
17 #include "chrome/browser/chromeos/cros/network_library.h" | 19 #include "chrome/browser/chromeos/cros/network_library.h" |
18 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" | 20 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" |
19 #include "chrome/browser/prefs/pref_service.h" | 21 #include "chrome/browser/prefs/pref_service.h" |
20 #include "chrome/browser/profiles/profile.h" | 22 #include "chrome/browser/profiles/profile.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 66 } |
65 | 67 |
66 // Overridden from ash::NetworkTrayDelegate: | 68 // Overridden from ash::NetworkTrayDelegate: |
67 virtual void NotificationLinkClicked(size_t index) OVERRIDE { | 69 virtual void NotificationLinkClicked(size_t index) OVERRIDE { |
68 base::ListValue empty_value; | 70 base::ListValue empty_value; |
69 if (!callback_.is_null()) | 71 if (!callback_.is_null()) |
70 callback_.Run(&empty_value); | 72 callback_.Run(&empty_value); |
71 } | 73 } |
72 | 74 |
73 void Hide() { | 75 void Hide() { |
74 ash::Shell::GetInstance()->system_tray()->network_observer()-> | 76 ash::SystemTrayObservers* observers = |
75 ClearNetworkMessage(error_type_); | 77 ash::Shell::GetInstance()->tray_delegate()->GetSystemTrayObservers(); |
| 78 if (observers) { |
| 79 FOR_EACH_OBSERVER(ash::NetworkObserver, |
| 80 observers->network_observers(), |
| 81 ClearNetworkMessage(error_type_)); |
| 82 } |
76 } | 83 } |
77 | 84 |
78 void SetTitle(const string16& title) { | 85 void SetTitle(const string16& title) { |
79 title_ = title; | 86 title_ = title; |
80 } | 87 } |
81 | 88 |
82 void Show(const string16& message, | 89 void Show(const string16& message, |
83 const string16& link_text, | 90 const string16& link_text, |
84 const BalloonViewHost::MessageCallback& callback, | 91 const BalloonViewHost::MessageCallback& callback, |
85 bool urgent, bool sticky) { | 92 bool urgent, bool sticky) { |
86 callback_ = callback; | 93 callback_ = callback; |
87 std::vector<string16> links; | 94 std::vector<string16> links; |
88 links.push_back(link_text); | 95 links.push_back(link_text); |
89 ash::Shell::GetInstance()->system_tray()->network_observer()-> | 96 ash::SystemTrayObservers* observers = |
90 SetNetworkMessage(this, error_type_, title_, message, links); | 97 ash::Shell::GetInstance()->tray_delegate()->GetSystemTrayObservers(); |
| 98 if (observers) { |
| 99 FOR_EACH_OBSERVER( |
| 100 ash::NetworkObserver, |
| 101 observers->network_observers(), |
| 102 SetNetworkMessage(this, error_type_, title_, message, links)); |
| 103 } |
91 } | 104 } |
92 | 105 |
93 void ShowAlways(const string16& message, | 106 void ShowAlways(const string16& message, |
94 const string16& link_text, | 107 const string16& link_text, |
95 const BalloonViewHost::MessageCallback& callback, | 108 const BalloonViewHost::MessageCallback& callback, |
96 bool urgent, bool sticky) { | 109 bool urgent, bool sticky) { |
97 Show(message, link_text, callback, urgent, sticky); | 110 Show(message, link_text, callback, urgent, sticky); |
98 } | 111 } |
99 | 112 |
100 private: | 113 private: |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (plan) { | 375 if (plan) { |
363 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); | 376 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); |
364 cellular_data_plan_type_ = plan->plan_type; | 377 cellular_data_plan_type_ = plan->plan_type; |
365 } else { | 378 } else { |
366 cellular_data_plan_unique_id_ = std::string(); | 379 cellular_data_plan_unique_id_ = std::string(); |
367 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; | 380 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; |
368 } | 381 } |
369 } | 382 } |
370 | 383 |
371 } // namespace chromeos | 384 } // namespace chromeos |
OLD | NEW |