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

Side by Side Diff: chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.cc

Issue 2507073002: Split ArcSessionManager from ArcAuthService. (Closed)
Patch Set: Fix rebase mistake Created 4 years, 1 month 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 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h" 4 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_controller.h"
5 5
6 #include <string> 6 #include <string>
7 7
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/shelf/shelf_delegate.h" 9 #include "ash/common/shelf/shelf_delegate.h"
10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 10 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
11 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
12 #include "ash/common/wm_lookup.h" 12 #include "ash/common/wm_lookup.h"
13 #include "ash/common/wm_shell.h" 13 #include "ash/common/wm_shell.h"
14 #include "ash/common/wm_window_property.h" 14 #include "ash/common/wm_window_property.h"
15 #include "ash/display/screen_orientation_controller_chromeos.h" 15 #include "ash/display/screen_orientation_controller_chromeos.h"
16 #include "ash/shared/app_types.h" 16 #include "ash/shared/app_types.h"
17 #include "ash/shell.h" 17 #include "ash/shell.h"
18 #include "ash/wm/window_state_aura.h" 18 #include "ash/wm/window_state_aura.h"
19 #include "ash/wm/window_util.h" 19 #include "ash/wm/window_util.h"
20 #include "base/bind.h" 20 #include "base/bind.h"
21 #include "chrome/browser/chromeos/arc/arc_auth_service.h" 21 #include "chrome/browser/chromeos/arc/arc_session_manager.h"
22 #include "chrome/browser/chromeos/arc/arc_support_host.h" 22 #include "chrome/browser/chromeos/arc/arc_support_host.h"
23 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h" 24 #include "chrome/browser/ui/app_list/arc/arc_app_utils.h"
25 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller .h" 25 #include "chrome/browser/ui/ash/launcher/arc_app_window_launcher_item_controller .h"
26 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 26 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
27 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 27 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
28 #include "components/arc/arc_bridge_service.h" 28 #include "components/arc/arc_bridge_service.h"
29 #include "components/exo/shell_surface.h" 29 #include "components/exo/shell_surface.h"
30 #include "components/signin/core/account_id/account_id.h" 30 #include "components/signin/core/account_id/account_id.h"
31 #include "components/user_manager/user_manager.h" 31 #include "components/user_manager/user_manager.h"
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 ArcAppWindowLauncherItemController* controller_ = nullptr; 240 ArcAppWindowLauncherItemController* controller_ = nullptr;
241 // Unowned pointer, represents host Arc window. 241 // Unowned pointer, represents host Arc window.
242 242
243 DISALLOW_COPY_AND_ASSIGN(AppWindow); 243 DISALLOW_COPY_AND_ASSIGN(AppWindow);
244 }; 244 };
245 245
246 ArcAppWindowLauncherController::ArcAppWindowLauncherController( 246 ArcAppWindowLauncherController::ArcAppWindowLauncherController(
247 ChromeLauncherController* owner, 247 ChromeLauncherController* owner,
248 ash::ShelfDelegate* shelf_delegate) 248 ash::ShelfDelegate* shelf_delegate)
249 : AppWindowLauncherController(owner), shelf_delegate_(shelf_delegate) { 249 : AppWindowLauncherController(owner), shelf_delegate_(shelf_delegate) {
250 if (arc::ArcAuthService::IsAllowedForProfile(owner->profile())) { 250 if (arc::ArcSessionManager::IsAllowedForProfile(owner->profile())) {
251 observed_profile_ = owner->profile(); 251 observed_profile_ = owner->profile();
252 StartObserving(observed_profile_); 252 StartObserving(observed_profile_);
253 } 253 }
254 } 254 }
255 255
256 ArcAppWindowLauncherController::~ArcAppWindowLauncherController() { 256 ArcAppWindowLauncherController::~ArcAppWindowLauncherController() {
257 if (observed_profile_) 257 if (observed_profile_)
258 StopObserving(observed_profile_); 258 StopObserving(observed_profile_);
259 if (observing_shell_) 259 if (observing_shell_)
260 ash::WmShell::Get()->RemoveShellObserver(this); 260 ash::WmShell::Get()->RemoveShellObserver(this);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // Some controllers might have no windows attached, for example background 300 // Some controllers might have no windows attached, for example background
301 // task when foreground tasks is in full screen. 301 // task when foreground tasks is in full screen.
302 for (const auto& it : app_controller_map_) 302 for (const auto& it : app_controller_map_)
303 owner()->CloseLauncherItem(it.second->shelf_id()); 303 owner()->CloseLauncherItem(it.second->shelf_id());
304 app_controller_map_.clear(); 304 app_controller_map_.clear();
305 } 305 }
306 } 306 }
307 307
308 void ArcAppWindowLauncherController::AdditionalUserAddedToSession( 308 void ArcAppWindowLauncherController::AdditionalUserAddedToSession(
309 Profile* profile) { 309 Profile* profile) {
310 DCHECK(!arc::ArcAuthService::IsAllowedForProfile(profile)); 310 DCHECK(!arc::ArcSessionManager::IsAllowedForProfile(profile));
311 } 311 }
312 312
313 void ArcAppWindowLauncherController::OnWindowInitialized(aura::Window* window) { 313 void ArcAppWindowLauncherController::OnWindowInitialized(aura::Window* window) {
314 // An arc window has type WINDOW_TYPE_NORMAL, a WindowDelegate and 314 // An arc window has type WINDOW_TYPE_NORMAL, a WindowDelegate and
315 // is a top level views widget. 315 // is a top level views widget.
316 if (window->type() != ui::wm::WINDOW_TYPE_NORMAL || !window->delegate()) 316 if (window->type() != ui::wm::WINDOW_TYPE_NORMAL || !window->delegate())
317 return; 317 return;
318 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window); 318 views::Widget* widget = views::Widget::GetWidgetForNativeWindow(window);
319 if (!widget || !widget->is_top_level()) 319 if (!widget || !widget->is_top_level())
320 return; 320 return;
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); 717 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window);
718 if (arc_app_id.empty()) 718 if (arc_app_id.empty())
719 return -1; 719 return -1;
720 720
721 int task_id = -1; 721 int task_id = -1;
722 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) 722 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1)
723 return -1; 723 return -1;
724 724
725 return task_id; 725 return task_id;
726 } 726 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698