| 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 "apps/ui/native_app_window.h" | 7 #include "apps/ui/native_app_window.h" |
| 8 #include "ash/shelf/shelf_model.h" | 8 #include "ash/shelf/shelf_model.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 TabStripModel* tab_strip = browser->tab_strip_model(); | 335 TabStripModel* tab_strip = browser->tab_strip_model(); |
| 336 content::WebContents* active = tab_strip->GetWebContentsAt( | 336 content::WebContents* active = tab_strip->GetWebContentsAt( |
| 337 tab_strip->active_index()); | 337 tab_strip->active_index()); |
| 338 std::vector<content::WebContents*>::const_iterator i( | 338 std::vector<content::WebContents*>::const_iterator i( |
| 339 std::find(items.begin(), items.end(), active)); | 339 std::find(items.begin(), items.end(), active)); |
| 340 if (i != items.end()) { | 340 if (i != items.end()) { |
| 341 if (items.size() == 1) { | 341 if (items.size() == 1) { |
| 342 // If there is only a single item available, we animate it upon key | 342 // If there is only a single item available, we animate it upon key |
| 343 // action. | 343 // action. |
| 344 AnimateWindow(browser->window()->GetNativeWindow(), | 344 AnimateWindow(browser->window()->GetNativeWindow(), |
| 345 views::corewm::WINDOW_ANIMATION_TYPE_BOUNCE); | 345 wm::WINDOW_ANIMATION_TYPE_BOUNCE); |
| 346 } else { | 346 } else { |
| 347 int index = (static_cast<int>(i - items.begin()) + 1) % items.size(); | 347 int index = (static_cast<int>(i - items.begin()) + 1) % items.size(); |
| 348 ActivateContent(items[index]); | 348 ActivateContent(items[index]); |
| 349 } | 349 } |
| 350 return true; | 350 return true; |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 return false; | 354 return false; |
| 355 } | 355 } |
| 356 | 356 |
| 357 bool AppShortcutLauncherItemController::IsV2App() { | 357 bool AppShortcutLauncherItemController::IsV2App() { |
| 358 const Extension* extension = | 358 const Extension* extension = |
| 359 launcher_controller()->GetExtensionForAppID(app_id()); | 359 launcher_controller()->GetExtensionForAppID(app_id()); |
| 360 return extension && extension->is_platform_app(); | 360 return extension && extension->is_platform_app(); |
| 361 } | 361 } |
| 362 | 362 |
| 363 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 363 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
| 364 if (last_launch_attempt_.is_null() || | 364 if (last_launch_attempt_.is_null() || |
| 365 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 365 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
| 366 kClickSuppressionInMS) < base::Time::Now()) { | 366 kClickSuppressionInMS) < base::Time::Now()) { |
| 367 last_launch_attempt_ = base::Time::Now(); | 367 last_launch_attempt_ = base::Time::Now(); |
| 368 return true; | 368 return true; |
| 369 } | 369 } |
| 370 return false; | 370 return false; |
| 371 } | 371 } |
| OLD | NEW |