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

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

Issue 2661283002: cros: Clean up SessionStateDelegate refs in Chrome (Closed)
Patch Set: update browser_finder_chromeos_unittest Created 3 years, 9 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/palette_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/palette_delegate_chromeos.h"
6 6
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
8 #include "ash/common/system/chromeos/palette/palette_utils.h" 8 #include "ash/common/system/chromeos/palette/palette_utils.h"
9 #include "ash/screenshot_delegate.h" 9 #include "ash/screenshot_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 base::FilePath()); 49 base::FilePath());
50 } 50 }
51 51
52 bool PaletteDelegateChromeOS::HasNoteApp() { 52 bool PaletteDelegateChromeOS::HasNoteApp() {
53 if (!profile_) 53 if (!profile_)
54 return false; 54 return false;
55 55
56 return chromeos::NoteTakingHelper::Get()->IsAppAvailable(profile_); 56 return chromeos::NoteTakingHelper::Get()->IsAppAvailable(profile_);
57 } 57 }
58 58
59 void PaletteDelegateChromeOS::ActiveUserChanged(const AccountId& account_id) { 59 void PaletteDelegateChromeOS::ActiveUserChanged(
60 const user_manager::User* user = 60 const user_manager::User* active_user) {
61 user_manager::UserManager::Get()->FindUser(account_id); 61 SetProfile(ProfileHelper::Get()->GetProfileByUser(active_user));
62 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user);
63 SetProfile(profile);
64 } 62 }
65 63
66 void PaletteDelegateChromeOS::Observe( 64 void PaletteDelegateChromeOS::Observe(
67 int type, 65 int type,
68 const content::NotificationSource& source, 66 const content::NotificationSource& source,
69 const content::NotificationDetails& details) { 67 const content::NotificationDetails& details) {
70 switch (type) { 68 switch (type) {
71 case chrome::NOTIFICATION_SESSION_STARTED: 69 case chrome::NOTIFICATION_SESSION_STARTED:
72 // Update |profile_| when entering a session. 70 // Update |profile_| when entering a session.
73 SetProfile(ProfileManager::GetActiveUserProfile()); 71 SetProfile(ProfileManager::GetActiveUserProfile());
74 72
75 // Add a session state observer to be able to monitor session changes. 73 // Add a session state observer to be able to monitor session changes.
76 if (!session_state_observer_.get() && ash::Shell::HasInstance()) { 74 if (!session_state_observer_.get()) {
77 session_state_observer_.reset( 75 session_state_observer_.reset(
78 new ash::ScopedSessionStateObserver(this)); 76 new user_manager::ScopedUserSessionStateObserver(this));
79 } 77 }
80 break; 78 break;
81 case chrome::NOTIFICATION_PROFILE_DESTROYED: { 79 case chrome::NOTIFICATION_PROFILE_DESTROYED: {
82 // Update |profile_| when exiting a session or shutting down. 80 // Update |profile_| when exiting a session or shutting down.
83 Profile* profile = content::Source<Profile>(source).ptr(); 81 Profile* profile = content::Source<Profile>(source).ptr();
84 if (profile_ == profile) 82 if (profile_ == profile)
85 SetProfile(nullptr); 83 SetProfile(nullptr);
86 break; 84 break;
87 } 85 }
88 } 86 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 screenshot_controller->set_on_screenshot_session_done( 151 screenshot_controller->set_on_screenshot_session_done(
154 base::Bind(&PaletteDelegateChromeOS::OnPartialScreenshotDone, 152 base::Bind(&PaletteDelegateChromeOS::OnPartialScreenshotDone,
155 weak_factory_.GetWeakPtr(), done)); 153 weak_factory_.GetWeakPtr(), done));
156 } 154 }
157 155
158 void PaletteDelegateChromeOS::CancelPartialScreenshot() { 156 void PaletteDelegateChromeOS::CancelPartialScreenshot() {
159 ash::Shell::GetInstance()->screenshot_controller()->CancelScreenshotSession(); 157 ash::Shell::GetInstance()->screenshot_controller()->CancelScreenshotSession();
160 } 158 }
161 159
162 } // namespace chromeos 160 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/palette_delegate_chromeos.h ('k') | chrome/browser/ui/ash/session_controller_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698