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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos.cc

Issue 2933923002: Remove update icon after user confirms download (Closed)
Patch Set: Add initialized_ Created 3 years, 6 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
OLDNEW
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/ui/ash/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 28 matching lines...) Expand all
39 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" 39 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
40 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h" 40 #include "chrome/browser/ui/ash/networking_config_delegate_chromeos.h"
41 #include "chrome/browser/ui/ash/system_tray_client.h" 41 #include "chrome/browser/ui/ash/system_tray_client.h"
42 #include "chrome/browser/ui/browser.h" 42 #include "chrome/browser/ui/browser.h"
43 #include "chrome/browser/ui/browser_list.h" 43 #include "chrome/browser/ui/browser_list.h"
44 #include "chrome/browser/ui/chrome_pages.h" 44 #include "chrome/browser/ui/chrome_pages.h"
45 #include "chrome/common/chrome_switches.h" 45 #include "chrome/common/chrome_switches.h"
46 #include "chrome/common/features.h" 46 #include "chrome/common/features.h"
47 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
48 #include "chrome/grit/generated_resources.h" 48 #include "chrome/grit/generated_resources.h"
49 #include "chromeos/dbus/dbus_thread_manager.h"
49 #include "chromeos/login/login_state.h" 50 #include "chromeos/login/login_state.h"
50 #include "chromeos/network/portal_detector/network_portal_detector.h" 51 #include "chromeos/network/portal_detector/network_portal_detector.h"
51 #include "components/google/core/browser/google_util.h" 52 #include "components/google/core/browser/google_util.h"
52 #include "components/prefs/pref_service.h" 53 #include "components/prefs/pref_service.h"
53 #include "components/session_manager/core/session_manager.h" 54 #include "components/session_manager/core/session_manager.h"
54 #include "components/user_manager/user.h" 55 #include "components/user_manager/user.h"
55 #include "components/user_manager/user_manager.h" 56 #include "components/user_manager/user_manager.h"
56 #include "components/user_manager/user_type.h" 57 #include "components/user_manager/user_type.h"
57 #include "content/public/browser/notification_observer.h" 58 #include "content/public/browser/notification_observer.h"
58 #include "content/public/browser/notification_service.h" 59 #include "content/public/browser/notification_service.h"
(...skipping 23 matching lines...) Expand all
82 void OnAcceptMultiprofilesIntro(bool no_show_again) { 83 void OnAcceptMultiprofilesIntro(bool no_show_again) {
83 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs(); 84 PrefService* prefs = ProfileManager::GetActiveUserProfile()->GetPrefs();
84 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again); 85 prefs->SetBoolean(prefs::kMultiProfileNeverShowIntro, no_show_again);
85 UserAddingScreen::Get()->Start(); 86 UserAddingScreen::Get()->Start();
86 } 87 }
87 88
88 } // namespace 89 } // namespace
89 90
90 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS() 91 SystemTrayDelegateChromeOS::SystemTrayDelegateChromeOS()
91 : networking_config_delegate_( 92 : networking_config_delegate_(
92 base::MakeUnique<NetworkingConfigDelegateChromeos>()) { 93 base::MakeUnique<NetworkingConfigDelegateChromeos>()),
94 initialized_(false) {
93 // Register notifications on construction so that events such as 95 // Register notifications on construction so that events such as
94 // PROFILE_CREATED do not get missed if they happen before Initialize(). 96 // PROFILE_CREATED do not get missed if they happen before Initialize().
95 registrar_.reset(new content::NotificationRegistrar); 97 registrar_.reset(new content::NotificationRegistrar);
96 if (SystemTrayClient::GetUserLoginStatus() == 98 if (SystemTrayClient::GetUserLoginStatus() ==
97 ash::LoginStatus::NOT_LOGGED_IN) { 99 ash::LoginStatus::NOT_LOGGED_IN) {
98 registrar_->Add(this, 100 registrar_->Add(this,
99 chrome::NOTIFICATION_SESSION_STARTED, 101 chrome::NOTIFICATION_SESSION_STARTED,
100 content::NotificationService::AllSources()); 102 content::NotificationService::AllSources());
101 } 103 }
102 registrar_->Add(this, 104 registrar_->Add(this,
103 chrome::NOTIFICATION_PROFILE_CREATED, 105 chrome::NOTIFICATION_PROFILE_CREATED,
104 content::NotificationService::AllSources()); 106 content::NotificationService::AllSources());
105 registrar_->Add(this, 107 registrar_->Add(this,
106 chrome::NOTIFICATION_PROFILE_DESTROYED, 108 chrome::NOTIFICATION_PROFILE_DESTROYED,
107 content::NotificationService::AllSources()); 109 content::NotificationService::AllSources());
108 110
109 AccessibilityManager* accessibility_manager = AccessibilityManager::Get(); 111 AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
110 CHECK(accessibility_manager); 112 CHECK(accessibility_manager);
111 accessibility_subscription_ = accessibility_manager->RegisterCallback( 113 accessibility_subscription_ = accessibility_manager->RegisterCallback(
112 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged, 114 base::Bind(&SystemTrayDelegateChromeOS::OnAccessibilityStatusChanged,
113 base::Unretained(this))); 115 base::Unretained(this)));
114 } 116 }
115 117
116 void SystemTrayDelegateChromeOS::Initialize() { 118 void SystemTrayDelegateChromeOS::Initialize() {
117 input_method::InputMethodManager::Get()->AddObserver(this); 119 input_method::InputMethodManager::Get()->AddObserver(this);
118 input_method::InputMethodManager::Get()->AddImeMenuObserver(this); 120 input_method::InputMethodManager::Get()->AddImeMenuObserver(this);
119 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this); 121 ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this);
122 BrowserList::AddObserver(this);
123 DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this);
120 124
121 BrowserList::AddObserver(this); 125 initialized_ = true;
122 } 126 }
123 127
124 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() { 128 SystemTrayDelegateChromeOS::~SystemTrayDelegateChromeOS() {
125 user_pref_registrar_.reset(); 129 user_pref_registrar_.reset();
126 130
127 // Unregister content notifications before destroying any components. 131 // Unregister content notifications before destroying any components.
128 registrar_.reset(); 132 registrar_.reset();
129 133
130 // Unregister a11y status subscription. 134 // Unregister a11y status subscription.
131 accessibility_subscription_.reset(); 135 accessibility_subscription_.reset();
132 136
133 input_method::InputMethodManager::Get()->RemoveObserver(this); 137 StopObservingAppWindowRegistry();
134 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this);
135 138
136 BrowserList::RemoveObserver(this); 139 if (initialized_) {
stevenjb 2017/06/13 20:29:53 This is not actually what I was suggesting, althou
137 StopObservingAppWindowRegistry(); 140 input_method::InputMethodManager::Get()->RemoveObserver(this);
141 input_method::InputMethodManager::Get()->RemoveImeMenuObserver(this);
142 ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this);
143 BrowserList::RemoveObserver(this);
144 DBusThreadManager::Get()->GetUpdateEngineClient()->RemoveObserver(this);
stevenjb 2017/06/13 20:29:53 With or without |initiaizled_|, this should be: i
weidongg 2017/06/13 20:51:25 Aha, I see. Thanks for explanation. Done.
145 }
138 } 146 }
139 147
140 void SystemTrayDelegateChromeOS::ShowUserLogin() { 148 void SystemTrayDelegateChromeOS::ShowUserLogin() {
141 if (!ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled()) 149 if (!ash::Shell::Get()->shell_delegate()->IsMultiProfilesEnabled())
142 return; 150 return;
143 151
144 // Only regular non-supervised users could add other users to current session. 152 // Only regular non-supervised users could add other users to current session.
145 if (user_manager::UserManager::Get()->GetActiveUser()->GetType() != 153 if (user_manager::UserManager::Get()->GetActiveUser()->GetType() !=
146 user_manager::USER_TYPE_REGULAR) { 154 user_manager::USER_TYPE_REGULAR) {
147 return; 155 return;
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) { 441 void SystemTrayDelegateChromeOS::ImeMenuActivationChanged(bool is_active) {
434 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active); 442 GetSystemTrayNotifier()->NotifyRefreshIMEMenu(is_active);
435 } 443 }
436 444
437 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {} 445 void SystemTrayDelegateChromeOS::ImeMenuListChanged() {}
438 446
439 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged( 447 void SystemTrayDelegateChromeOS::ImeMenuItemsChanged(
440 const std::string& engine_id, 448 const std::string& engine_id,
441 const std::vector<input_method::InputMethodManager::MenuItem>& items) {} 449 const std::vector<input_method::InputMethodManager::MenuItem>& items) {}
442 450
451 void SystemTrayDelegateChromeOS::OnUpdateOverCellularTargetSet(bool success) {
452 GetSystemTrayNotifier()->NotifyUpdateOverCellularTargetSet(success);
453 }
454
443 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 455 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
444 return new SystemTrayDelegateChromeOS(); 456 return new SystemTrayDelegateChromeOS();
445 } 457 }
446 458
447 } // namespace chromeos 459 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.h ('k') | chromeos/dbus/update_engine_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698