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

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

Issue 2763893004: arc: Fix regression in handling ARC shelf item. (Closed)
Patch Set: 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 #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/common/shelf/shelf_delegate.h" 8 #include "ash/common/shelf/shelf_delegate.h"
9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
10 #include "ash/common/wm/window_state.h" 10 #include "ash/common/wm/window_state.h"
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 ->maximize_mode_controller() 559 ->maximize_mode_controller()
560 ->IsMaximizeModeWindowManagerEnabled()) { 560 ->IsMaximizeModeWindowManagerEnabled()) {
561 AppWindow* app_window = info->app_window(); 561 AppWindow* app_window = info->app_window();
562 if (app_window) 562 if (app_window)
563 SetOrientationLockForAppWindow(app_window); 563 SetOrientationLockForAppWindow(app_window);
564 } 564 }
565 } 565 }
566 566
567 AppWindowLauncherItemController* 567 AppWindowLauncherItemController*
568 ArcAppWindowLauncherController::ControllerForWindow(aura::Window* window) { 568 ArcAppWindowLauncherController::ControllerForWindow(aura::Window* window) {
569 if (!window)
570 return nullptr;
571
569 AppWindow* app_window = GetAppWindowForTask(active_task_id_); 572 AppWindow* app_window = GetAppWindowForTask(active_task_id_);
570 if (app_window && 573 if (app_window &&
571 app_window->widget() == views::Widget::GetWidgetForNativeWindow(window)) { 574 app_window->widget() == views::Widget::GetWidgetForNativeWindow(window)) {
572 return app_window->controller(); 575 return app_window->controller();
573 } 576 }
574 577
575 for (auto& it : task_id_to_app_window_info_) { 578 for (auto& it : task_id_to_app_window_info_) {
576 AppWindow* app_window = it.second->app_window(); 579 AppWindow* app_window = it.second->app_window();
577 if (app_window && 580 if (app_window &&
578 app_window->widget() == 581 app_window->widget() ==
579 views::Widget::GetWidgetForNativeWindow(window)) { 582 views::Widget::GetWidgetForNativeWindow(window)) {
580 return it.second->app_window()->controller(); 583 return it.second->app_window()->controller();
581 } 584 }
582 } 585 }
583 586
584 return nullptr; 587 return nullptr;
585 } 588 }
586 589
587 void ArcAppWindowLauncherController::OnWindowActivated( 590 void ArcAppWindowLauncherController::OnWindowActivated(
588 aura::client::ActivationChangeObserver::ActivationReason reason, 591 aura::client::ActivationChangeObserver::ActivationReason reason,
589 aura::Window* gained_active, 592 aura::Window* gained_active,
590 aura::Window* lost_active) { 593 aura::Window* lost_active) {
594 AppWindowLauncherController::OnWindowActivated(reason, gained_active,
khmel 2017/03/22 00:07:03 Required to store last active window.
595 lost_active);
591 OnTaskSetActive(active_task_id_); 596 OnTaskSetActive(active_task_id_);
592 } 597 }
593 598
594 void ArcAppWindowLauncherController::OnMaximizeModeStarted() { 599 void ArcAppWindowLauncherController::OnMaximizeModeStarted() {
595 for (auto& it : task_id_to_app_window_info_) { 600 for (auto& it : task_id_to_app_window_info_) {
596 AppWindow* app_window = it.second->app_window(); 601 AppWindow* app_window = it.second->app_window();
597 if (app_window) 602 if (app_window)
598 SetOrientationLockForAppWindow(app_window); 603 SetOrientationLockForAppWindow(app_window);
599 } 604 }
600 } 605 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window); 723 const std::string arc_app_id = exo::ShellSurface::GetApplicationId(window);
719 if (arc_app_id.empty()) 724 if (arc_app_id.empty())
720 return -1; 725 return -1;
721 726
722 int task_id = -1; 727 int task_id = -1;
723 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1) 728 if (sscanf(arc_app_id.c_str(), "org.chromium.arc.%d", &task_id) != 1)
724 return -1; 729 return -1;
725 730
726 return task_id; 731 return task_id;
727 } 732 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698