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_notifier.h" |
11 #include "base/bind.h" | 12 #include "base/bind.h" |
12 #include "base/callback.h" | 13 #include "base/callback.h" |
13 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
14 #include "base/string_number_conversions.h" | 15 #include "base/string_number_conversions.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/chromeos/cros/cros_library.h" | 17 #include "chrome/browser/chromeos/cros/cros_library.h" |
17 #include "chrome/browser/chromeos/cros/network_library.h" | 18 #include "chrome/browser/chromeos/cros/network_library.h" |
18 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" | 19 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" |
19 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 } | 65 } |
65 | 66 |
66 // Overridden from ash::NetworkTrayDelegate: | 67 // Overridden from ash::NetworkTrayDelegate: |
67 virtual void NotificationLinkClicked(size_t index) OVERRIDE { | 68 virtual void NotificationLinkClicked(size_t index) OVERRIDE { |
68 base::ListValue empty_value; | 69 base::ListValue empty_value; |
69 if (!callback_.is_null()) | 70 if (!callback_.is_null()) |
70 callback_.Run(&empty_value); | 71 callback_.Run(&empty_value); |
71 } | 72 } |
72 | 73 |
73 void Hide() { | 74 void Hide() { |
74 ash::Shell::GetInstance()->system_tray()->network_observer()-> | 75 ash::Shell::GetInstance()->system_tray_notifier()-> |
75 ClearNetworkMessage(error_type_); | 76 NotifyClearNetworkMessage(error_type_); |
76 } | 77 } |
77 | 78 |
78 void SetTitle(const string16& title) { | 79 void SetTitle(const string16& title) { |
79 title_ = title; | 80 title_ = title; |
80 } | 81 } |
81 | 82 |
82 void Show(const string16& message, | 83 void Show(const string16& message, |
83 const string16& link_text, | 84 const string16& link_text, |
84 const BalloonViewHost::MessageCallback& callback, | 85 const BalloonViewHost::MessageCallback& callback, |
85 bool urgent, bool sticky) { | 86 bool urgent, bool sticky) { |
86 callback_ = callback; | 87 callback_ = callback; |
87 std::vector<string16> links; | 88 std::vector<string16> links; |
88 links.push_back(link_text); | 89 links.push_back(link_text); |
89 ash::Shell::GetInstance()->system_tray()->network_observer()-> | 90 ash::Shell::GetInstance()->system_tray_notifier()->NotifySetNetworkMessage( |
90 SetNetworkMessage(this, error_type_, title_, message, links); | 91 this, error_type_, title_, message, links); |
91 } | 92 } |
92 | 93 |
93 void ShowAlways(const string16& message, | 94 void ShowAlways(const string16& message, |
94 const string16& link_text, | 95 const string16& link_text, |
95 const BalloonViewHost::MessageCallback& callback, | 96 const BalloonViewHost::MessageCallback& callback, |
96 bool urgent, bool sticky) { | 97 bool urgent, bool sticky) { |
97 Show(message, link_text, callback, urgent, sticky); | 98 Show(message, link_text, callback, urgent, sticky); |
98 } | 99 } |
99 | 100 |
100 private: | 101 private: |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (plan) { | 363 if (plan) { |
363 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); | 364 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); |
364 cellular_data_plan_type_ = plan->plan_type; | 365 cellular_data_plan_type_ = plan->plan_type; |
365 } else { | 366 } else { |
366 cellular_data_plan_unique_id_ = std::string(); | 367 cellular_data_plan_unique_id_ = std::string(); |
367 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; | 368 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; |
368 } | 369 } |
369 } | 370 } |
370 | 371 |
371 } // namespace chromeos | 372 } // namespace chromeos |
OLD | NEW |