| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/launcher/browser_shortcut_launcher_item_controll
er.h" | 5 #include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controll
er.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
| 10 #include "ash/common/shelf/shelf_delegate.h" | 10 #include "ash/common/shelf/shelf_delegate.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (!browser || !IsBrowserFromActiveUser(browser) || | 123 if (!browser || !IsBrowserFromActiveUser(browser) || |
| 124 IsSettingsBrowser(browser)) | 124 IsSettingsBrowser(browser)) |
| 125 return; | 125 return; |
| 126 | 126 |
| 127 ash::WmWindowAura::Get(browser->window()->GetNativeWindow()) | 127 ash::WmWindowAura::Get(browser->window()->GetNativeWindow()) |
| 128 ->SetIntProperty( | 128 ->SetIntProperty( |
| 129 ash::WmWindowProperty::SHELF_ID, | 129 ash::WmWindowProperty::SHELF_ID, |
| 130 launcher_controller()->GetShelfIDForWebContents(web_contents)); | 130 launcher_controller()->GetShelfIDForWebContents(web_contents)); |
| 131 } | 131 } |
| 132 | 132 |
| 133 bool BrowserShortcutLauncherItemController::IsOpen() const { | |
| 134 const BrowserList* browser_list = BrowserList::GetInstance(); | |
| 135 for (BrowserList::const_iterator it = browser_list->begin(); | |
| 136 it != browser_list->end(); ++it) { | |
| 137 if (IsBrowserFromActiveUser(*it)) | |
| 138 return true; | |
| 139 } | |
| 140 return false; | |
| 141 } | |
| 142 | |
| 143 bool BrowserShortcutLauncherItemController::IsVisible() const { | 133 bool BrowserShortcutLauncherItemController::IsVisible() const { |
| 144 Browser* last_browser = | 134 Browser* last_browser = |
| 145 chrome::FindTabbedBrowser(launcher_controller()->profile(), true); | 135 chrome::FindTabbedBrowser(launcher_controller()->profile(), true); |
| 146 | 136 |
| 147 if (!last_browser) { | 137 if (!last_browser) { |
| 148 return false; | 138 return false; |
| 149 } | 139 } |
| 150 | 140 |
| 151 aura::Window* window = last_browser->window()->GetNativeWindow(); | 141 aura::Window* window = last_browser->window()->GetNativeWindow(); |
| 152 return ash::wm::IsActiveWindow(window); | 142 return ash::wm::IsActiveWindow(window); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 !browser->window()->IsMinimized()) { | 350 !browser->window()->IsMinimized()) { |
| 361 continue; | 351 continue; |
| 362 } | 352 } |
| 363 if (!IsBrowserRepresentedInBrowserList(browser) && | 353 if (!IsBrowserRepresentedInBrowserList(browser) && |
| 364 !browser->is_type_tabbed()) | 354 !browser->is_type_tabbed()) |
| 365 continue; | 355 continue; |
| 366 active_browsers.push_back(browser); | 356 active_browsers.push_back(browser); |
| 367 } | 357 } |
| 368 return active_browsers; | 358 return active_browsers; |
| 369 } | 359 } |
| OLD | NEW |