Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: chrome/browser/chromeos/network_message_observer.cc

Issue 10973015: Remove unused code in network_message_observer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/network/network_observer.h" 9 #include "ash/system/network/network_observer.h"
10 #include "ash/system/tray/system_tray.h" 10 #include "ash/system/tray/system_tray.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/callback.h" 12 #include "base/callback.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
16 #include "chrome/browser/chromeos/cros/cros_library.h" 16 #include "chrome/browser/chromeos/cros/cros_library.h"
17 #include "chrome/browser/chromeos/cros/network_library.h" 17 #include "chrome/browser/chromeos/cros/network_library.h"
18 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" 18 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h"
19 #include "chrome/browser/prefs/pref_service.h" 19 #include "chrome/browser/prefs/pref_service.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/ui/browser.h" 22 #include "chrome/browser/ui/browser.h"
23 #include "chrome/browser/ui/browser_finder.h" 23 #include "chrome/browser/ui/browser_finder.h"
24 #include "chrome/browser/ui/singleton_tabs.h" 24 #include "chrome/browser/ui/singleton_tabs.h"
25 #include "chrome/common/pref_names.h" 25 #include "chrome/common/pref_names.h"
26 #include "chrome/common/time_format.h" 26 #include "chrome/common/time_format.h"
27 #include "grit/generated_resources.h" 27 #include "grit/generated_resources.h"
28 #include "grit/theme_resources.h"
29 #include "ui/base/l10n/l10n_util.h" 28 #include "ui/base/l10n/l10n_util.h"
30 29
31 namespace { 30 namespace {
32 31
33 // Returns prefs::kShowPlanNotifications in the profile of the last active 32 // Returns prefs::kShowPlanNotifications in the profile of the last active
34 // browser. If there is no active browser, returns true. 33 // browser. If there is no active browser, returns true.
35 bool ShouldShowMobilePlanNotifications() { 34 bool ShouldShowMobilePlanNotifications() {
36 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord(); 35 Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
37 PrefService* prefs = profile->GetPrefs(); 36 PrefService* prefs = profile->GetPrefs();
38 return prefs->GetBoolean(prefs::kShowPlanNotifications); 37 return prefs->GetBoolean(prefs::kShowPlanNotifications);
39 } 38 }
40 39
41 } // namespace 40 } // namespace
42 41
43 namespace chromeos { 42 namespace chromeos {
44 43
45 class NetworkMessageNotification : public ash::NetworkTrayDelegate { 44 class NetworkMessageNotification : public ash::NetworkTrayDelegate {
46 public: 45 public:
47 NetworkMessageNotification(Profile* profile, 46 NetworkMessageNotification(Profile* profile,
48 ash::NetworkObserver::MessageType error_type) 47 ash::NetworkObserver::MessageType error_type)
49 : error_type_(error_type) { 48 : error_type_(error_type) {
50 std::string id;
51 int icon_id = 0;
52 switch (error_type) { 49 switch (error_type) {
53 case ash::NetworkObserver::ERROR_CONNECT_FAILED: 50 case ash::NetworkObserver::ERROR_CONNECT_FAILED:
54 id = "network_connection.chromeos";
55 icon_id = IDR_NOTIFICATION_NETWORK_FAILED;
56 title_ = l10n_util::GetStringUTF16(IDS_NETWORK_CONNECTION_ERROR_TITLE); 51 title_ = l10n_util::GetStringUTF16(IDS_NETWORK_CONNECTION_ERROR_TITLE);
57 break; 52 break;
58 case ash::NetworkObserver::MESSAGE_DATA_LOW: 53 case ash::NetworkObserver::MESSAGE_DATA_LOW:
59 id = "network_low_data.chromeos";
60 icon_id = IDR_NOTIFICATION_BARS_CRITICAL;
61 title_ = l10n_util::GetStringUTF16(IDS_NETWORK_LOW_DATA_TITLE); 54 title_ = l10n_util::GetStringUTF16(IDS_NETWORK_LOW_DATA_TITLE);
62 break; 55 break;
63 case ash::NetworkObserver::MESSAGE_DATA_NONE: 56 case ash::NetworkObserver::MESSAGE_DATA_NONE:
64 id = "network_no_data.chromeos";
65 icon_id = IDR_NOTIFICATION_BARS_EMPTY;
66 title_ = l10n_util::GetStringUTF16(IDS_NETWORK_OUT_OF_DATA_TITLE); 57 title_ = l10n_util::GetStringUTF16(IDS_NETWORK_OUT_OF_DATA_TITLE);
67 break; 58 break;
68 case ash::NetworkObserver::MESSAGE_DATA_PROMO: 59 case ash::NetworkObserver::MESSAGE_DATA_PROMO:
69 NOTREACHED(); 60 NOTREACHED();
70 break; 61 break;
71 } 62 }
72 DCHECK(!id.empty());
73 } 63 }
74 64
75 // Overridden from ash::NetworkTrayDelegate: 65 // Overridden from ash::NetworkTrayDelegate:
76 virtual void NotificationLinkClicked(size_t index) OVERRIDE { 66 virtual void NotificationLinkClicked(size_t index) OVERRIDE {
77 base::ListValue empty_value; 67 base::ListValue empty_value;
78 if (!callback_.is_null()) 68 if (!callback_.is_null())
79 callback_.Run(&empty_value); 69 callback_.Run(&empty_value);
80 } 70 }
81 71
82 void Hide() { 72 void Hide() {
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 if (plan) { 359 if (plan) {
370 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier(); 360 cellular_data_plan_unique_id_ = plan->GetUniqueIdentifier();
371 cellular_data_plan_type_ = plan->plan_type; 361 cellular_data_plan_type_ = plan->plan_type;
372 } else { 362 } else {
373 cellular_data_plan_unique_id_ = std::string(); 363 cellular_data_plan_unique_id_ = std::string();
374 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN; 364 cellular_data_plan_type_ = CELLULAR_DATA_PLAN_UNKNOWN;
375 } 365 }
376 } 366 }
377 367
378 } // namespace chromeos 368 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698