| OLD | NEW |
| 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/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" | 5 #include "chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h
" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
| 10 #include "chrome/browser/chromeos/arc/arc_support_host.h" | 10 #include "chrome/browser/chromeos/arc/arc_support_host.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // Some unit tests have no real extension. | 90 // Some unit tests have no real extension. |
| 91 if (extension) { | 91 if (extension) { |
| 92 set_refocus_url(GURL( | 92 set_refocus_url(GURL( |
| 93 extensions::AppLaunchInfo::GetLaunchWebURL(extension).spec() + "*")); | 93 extensions::AppLaunchInfo::GetLaunchWebURL(extension).spec() + "*")); |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 AppShortcutLauncherItemController::~AppShortcutLauncherItemController() { | 97 AppShortcutLauncherItemController::~AppShortcutLauncherItemController() { |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool AppShortcutLauncherItemController::IsOpen() const { | |
| 101 return !chrome_launcher_controller_-> | |
| 102 GetV1ApplicationsFromAppId(app_id()).empty(); | |
| 103 } | |
| 104 | |
| 105 bool AppShortcutLauncherItemController::IsVisible() const { | 100 bool AppShortcutLauncherItemController::IsVisible() const { |
| 106 // Return true if any browser window associated with the app is visible. | 101 // Return true if any browser window associated with the app is visible. |
| 107 std::vector<content::WebContents*> content = | 102 std::vector<content::WebContents*> content = |
| 108 chrome_launcher_controller_->GetV1ApplicationsFromAppId(app_id()); | 103 chrome_launcher_controller_->GetV1ApplicationsFromAppId(app_id()); |
| 109 for (size_t i = 0; i < content.size(); i++) { | 104 for (size_t i = 0; i < content.size(); i++) { |
| 110 Browser* browser = chrome::FindBrowserWithWebContents(content[i]); | 105 Browser* browser = chrome::FindBrowserWithWebContents(content[i]); |
| 111 if (browser && browser->window()->GetNativeWindow()->IsVisible()) | 106 if (browser && browser->window()->GetNativeWindow()->IsVisible()) |
| 112 return true; | 107 return true; |
| 113 } | 108 } |
| 114 return false; | 109 return false; |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 | 374 |
| 380 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 375 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
| 381 if (last_launch_attempt_.is_null() || | 376 if (last_launch_attempt_.is_null() || |
| 382 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 377 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
| 383 kClickSuppressionInMS) < base::Time::Now()) { | 378 kClickSuppressionInMS) < base::Time::Now()) { |
| 384 last_launch_attempt_ = base::Time::Now(); | 379 last_launch_attempt_ = base::Time::Now(); |
| 385 return true; | 380 return true; |
| 386 } | 381 } |
| 387 return false; | 382 return false; |
| 388 } | 383 } |
| OLD | NEW |