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/native_app_window.h" | 7 #include "apps/native_app_window.h" |
8 #include "ash/wm/window_util.h" | 8 #include "ash/wm/window_util.h" |
9 #include "chrome/browser/extensions/extension_process_manager.h" | 9 #include "chrome/browser/extensions/extension_process_manager.h" |
10 #include "chrome/browser/extensions/extension_system.h" | 10 #include "chrome/browser/extensions/extension_system.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 const GURL tab_url = web_contents->GetURL(); | 258 const GURL tab_url = web_contents->GetURL(); |
259 // There are three ways to identify the association of a URL with this | 259 // There are three ways to identify the association of a URL with this |
260 // extension: | 260 // extension: |
261 // - The refocus pattern is matched (needed for apps like drive). | 261 // - The refocus pattern is matched (needed for apps like drive). |
262 // - The extension's origin + extent gets matched. | 262 // - The extension's origin + extent gets matched. |
263 // - The launcher controller knows that the tab got created for this app. | 263 // - The launcher controller knows that the tab got created for this app. |
264 return ((!refocus_pattern.match_all_urls() && | 264 return ((!refocus_pattern.match_all_urls() && |
265 refocus_pattern.MatchesURL(tab_url)) || | 265 refocus_pattern.MatchesURL(tab_url)) || |
266 (extension->OverlapsWithOrigin(tab_url) && | 266 (extension->OverlapsWithOrigin(tab_url) && |
267 extension->web_extent().MatchesURL(tab_url)) || | 267 extension->web_extent().MatchesURL(tab_url)) || |
268 launcher_controller()->GetPerAppInterface()-> | 268 app_controller_->IsWebContentHandledByApplication(web_contents, |
269 IsWebContentHandledByApplication(web_contents, app_id())); | 269 app_id())); |
270 } | 270 } |
271 | 271 |
272 void AppShortcutLauncherItemController::ActivateContent( | 272 void AppShortcutLauncherItemController::ActivateContent( |
273 content::WebContents* content) { | 273 content::WebContents* content) { |
274 Browser* browser = chrome::FindBrowserWithWebContents(content); | 274 Browser* browser = chrome::FindBrowserWithWebContents(content); |
275 TabStripModel* tab_strip = browser->tab_strip_model(); | 275 TabStripModel* tab_strip = browser->tab_strip_model(); |
276 int index = tab_strip->GetIndexOfWebContents(content); | 276 int index = tab_strip->GetIndexOfWebContents(content); |
277 DCHECK_NE(TabStripModel::kNoTab, index); | 277 DCHECK_NE(TabStripModel::kNoTab, index); |
278 | 278 |
279 int old_index = tab_strip->active_index(); | 279 int old_index = tab_strip->active_index(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 318 |
319 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { | 319 bool AppShortcutLauncherItemController::AllowNextLaunchAttempt() { |
320 if (last_launch_attempt_.is_null() || | 320 if (last_launch_attempt_.is_null() || |
321 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( | 321 last_launch_attempt_ + base::TimeDelta::FromMilliseconds( |
322 kClickSuppressionInMS) < base::Time::Now()) { | 322 kClickSuppressionInMS) < base::Time::Now()) { |
323 last_launch_attempt_ = base::Time::Now(); | 323 last_launch_attempt_ = base::Time::Now(); |
324 return true; | 324 return true; |
325 } | 325 } |
326 return false; | 326 return false; |
327 } | 327 } |
OLD | NEW |