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 "ash/shelf/shelf_model.h" | 7 #include "ash/shelf/shelf_model.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/wm/window_util.h" | 9 #include "ash/wm/window_util.h" |
10 #include "chrome/browser/extensions/launch_util.h" | 10 #include "chrome/browser/extensions/launch_util.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 } | 169 } |
170 | 170 |
171 const Extension* extension = | 171 const Extension* extension = |
172 launcher_controller()->GetExtensionForAppID(app_id()); | 172 launcher_controller()->GetExtensionForAppID(app_id()); |
173 | 173 |
174 // It is possible to come here While an extension gets loaded. | 174 // It is possible to come here While an extension gets loaded. |
175 if (!extension) | 175 if (!extension) |
176 return items; | 176 return items; |
177 | 177 |
178 const BrowserList* ash_browser_list = | 178 const BrowserList* ash_browser_list = |
179 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 179 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH); |
180 for (BrowserList::const_iterator it = ash_browser_list->begin(); | 180 for (BrowserList::const_iterator it = ash_browser_list->begin(); |
181 it != ash_browser_list->end(); ++it) { | 181 it != ash_browser_list->end(); ++it) { |
182 Browser* browser = *it; | 182 Browser* browser = *it; |
183 if (!launcher_controller()->IsBrowserFromActiveUser(browser)) | 183 if (!launcher_controller()->IsBrowserFromActiveUser(browser)) |
184 continue; | 184 continue; |
185 TabStripModel* tab_strip = browser->tab_strip_model(); | 185 TabStripModel* tab_strip = browser->tab_strip_model(); |
186 for (int index = 0; index < tab_strip->count(); index++) { | 186 for (int index = 0; index < tab_strip->count(); index++) { |
187 content::WebContents* web_contents = tab_strip->GetWebContentsAt(index); | 187 content::WebContents* web_contents = tab_strip->GetWebContentsAt(index); |
188 if (WebContentMatchesApp( | 188 if (WebContentMatchesApp( |
189 extension, refocus_pattern, web_contents, browser)) | 189 extension, refocus_pattern, web_contents, browser)) |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 const Extension* extension = | 240 const Extension* extension = |
241 launcher_controller()->GetExtensionForAppID(app_id()); | 241 launcher_controller()->GetExtensionForAppID(app_id()); |
242 | 242 |
243 // We may get here while the extension is loading (and NULL). | 243 // We may get here while the extension is loading (and NULL). |
244 if (!extension) | 244 if (!extension) |
245 return NULL; | 245 return NULL; |
246 | 246 |
247 const BrowserList* ash_browser_list = | 247 const BrowserList* ash_browser_list = |
248 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_ASH); | 248 BrowserList::GetInstance(ui::HOST_DESKTOP_TYPE_ASH); |
249 for (BrowserList::const_reverse_iterator | 249 for (BrowserList::const_reverse_iterator |
250 it = ash_browser_list->begin_last_active(); | 250 it = ash_browser_list->begin_last_active(); |
251 it != ash_browser_list->end_last_active(); ++it) { | 251 it != ash_browser_list->end_last_active(); ++it) { |
252 Browser* browser = *it; | 252 Browser* browser = *it; |
253 if (!CanBrowserBeUsedForDirectActivation(browser, launcher_controller())) | 253 if (!CanBrowserBeUsedForDirectActivation(browser, launcher_controller())) |
254 continue; | 254 continue; |
255 TabStripModel* tab_strip = browser->tab_strip_model(); | 255 TabStripModel* tab_strip = browser->tab_strip_model(); |
256 // We start to enumerate from the active index. | 256 // We start to enumerate from the active index. |
257 int active_index = tab_strip->active_index(); | 257 int active_index = tab_strip->active_index(); |
258 for (int index = 0; index < tab_strip->count(); index++) { | 258 for (int index = 0; index < tab_strip->count(); index++) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 | 368 |
369 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 369 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
370 if (last_launch_attempt_.is_null() || | 370 if (last_launch_attempt_.is_null() || |
371 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 371 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
372 kClickSuppressionInMS) < base::Time::Now()) { | 372 kClickSuppressionInMS) < base::Time::Now()) { |
373 last_launch_attempt_ = base::Time::Now(); | 373 last_launch_attempt_ = base::Time::Now(); |
374 return true; | 374 return true; |
375 } | 375 } |
376 return false; | 376 return false; |
377 } | 377 } |
OLD | NEW |