OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/apps/app_url_redirector.h" | 5 #include "chrome/browser/apps/app_url_redirector.h" |
6 | 6 |
7 #include "apps/launcher.h" | 7 #include "apps/launcher.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "chrome/browser/prerender/prerender_contents.h" | 10 #include "chrome/browser/prerender/prerender_contents.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 using extensions::UrlHandlers; | 30 using extensions::UrlHandlers; |
31 using extensions::UrlHandlerInfo; | 31 using extensions::UrlHandlerInfo; |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 bool LaunchAppWithUrl( | 35 bool LaunchAppWithUrl( |
36 const scoped_refptr<const Extension> app, | 36 const scoped_refptr<const Extension> app, |
37 const std::string& handler_id, | 37 const std::string& handler_id, |
38 content::WebContents* source, | 38 content::WebContents* source, |
39 const navigation_interception::NavigationParams& params) { | 39 const navigation_interception::NavigationParams& params) { |
40 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 40 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
41 | 41 |
42 // Redirect top-level navigations only. This excludes iframes and webviews | 42 // Redirect top-level navigations only. This excludes iframes and webviews |
43 // in particular. | 43 // in particular. |
44 if (source->IsSubframe()) { | 44 if (source->IsSubframe()) { |
45 DVLOG(1) << "Cancel redirection: source is a subframe"; | 45 DVLOG(1) << "Cancel redirection: source is a subframe"; |
46 return false; | 46 return false; |
47 } | 47 } |
48 | 48 |
49 // If prerendering, don't launch the app but abort the navigation. | 49 // If prerendering, don't launch the app but abort the navigation. |
50 prerender::PrerenderContents* prerender_contents = | 50 prerender::PrerenderContents* prerender_contents = |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 request, | 120 request, |
121 base::Bind(&LaunchAppWithUrl, | 121 base::Bind(&LaunchAppWithUrl, |
122 scoped_refptr<const Extension>(*iter), | 122 scoped_refptr<const Extension>(*iter), |
123 handler->id)); | 123 handler->id)); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 DVLOG(1) << "Skipping redirection: no matching app handler found"; | 127 DVLOG(1) << "Skipping redirection: no matching app handler found"; |
128 return NULL; | 128 return NULL; |
129 } | 129 } |
OLD | NEW |