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::IsVisible() const { | |
134 Browser* last_browser = | |
135 chrome::FindTabbedBrowser(launcher_controller()->profile(), true); | |
136 | |
137 if (!last_browser) { | |
138 return false; | |
139 } | |
140 | |
141 aura::Window* window = last_browser->window()->GetNativeWindow(); | |
142 return ash::wm::IsActiveWindow(window); | |
143 } | |
144 | |
145 void BrowserShortcutLauncherItemController::Launch(ash::LaunchSource source, | 133 void BrowserShortcutLauncherItemController::Launch(ash::LaunchSource source, |
146 int event_flags) { | 134 int event_flags) { |
147 } | 135 } |
148 | 136 |
149 ash::ShelfItemDelegate::PerformedAction | 137 ash::ShelfItemDelegate::PerformedAction |
150 BrowserShortcutLauncherItemController::Activate(ash::LaunchSource source) { | 138 BrowserShortcutLauncherItemController::Activate(ash::LaunchSource source) { |
151 Browser* last_browser = | 139 Browser* last_browser = |
152 chrome::FindTabbedBrowser(launcher_controller()->profile(), true); | 140 chrome::FindTabbedBrowser(launcher_controller()->profile(), true); |
153 | 141 |
154 if (!last_browser) { | 142 if (!last_browser) { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 !browser->window()->IsMinimized()) { | 324 !browser->window()->IsMinimized()) { |
337 continue; | 325 continue; |
338 } | 326 } |
339 if (!IsBrowserRepresentedInBrowserList(browser) && | 327 if (!IsBrowserRepresentedInBrowserList(browser) && |
340 !browser->is_type_tabbed()) | 328 !browser->is_type_tabbed()) |
341 continue; | 329 continue; |
342 active_browsers.push_back(browser); | 330 active_browsers.push_back(browser); |
343 } | 331 } |
344 return active_browsers; | 332 return active_browsers; |
345 } | 333 } |
OLD | NEW |