Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(409)

Side by Side Diff: chrome/browser/apps/ephemeral_app_throttle.cc

Issue 481433005: Extensions: Move id_util functions to crx_file component. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert last patchset. function returns Extension* and can't use an assert. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/apps/install_chrome_app.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/ephemeral_app_throttle.h" 5 #include "chrome/browser/apps/ephemeral_app_throttle.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/apps/ephemeral_app_launcher.h" 8 #include "chrome/browser/apps/ephemeral_app_launcher.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
11 #include "chrome/browser/profiles/profile_io_data.h" 11 #include "chrome/browser/profiles/profile_io_data.h"
12 #include "chrome/common/chrome_switches.h" 12 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/extensions/extension_constants.h" 13 #include "chrome/common/extensions/extension_constants.h"
14 #include "components/crx_file/id_util.h"
14 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h" 15 #include "components/navigation_interception/intercept_navigation_resource_throt tle.h"
15 #include "components/navigation_interception/navigation_params.h" 16 #include "components/navigation_interception/navigation_params.h"
16 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/resource_throttle.h" 18 #include "content/public/browser/resource_throttle.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 #include "extensions/browser/extension_system.h" 20 #include "extensions/browser/extension_system.h"
20 #include "net/url_request/url_request.h" 21 #include "net/url_request/url_request.h"
21 22
22 using content::BrowserThread; 23 using content::BrowserThread;
23 using content::WebContents; 24 using content::WebContents;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // the app ID will be after the last slash of the URL. We cannot even 85 // the app ID will be after the last slash of the URL. We cannot even
85 // differentiate between apps and extensions, so attempt to launch both. 86 // differentiate between apps and extensions, so attempt to launch both.
86 // This is obviously for demonstration purposes only and will be implemented 87 // This is obviously for demonstration purposes only and will be implemented
87 // properly in production code - for example, links to ephemeral apps could 88 // properly in production code - for example, links to ephemeral apps could
88 // have a new scheme. 89 // have a new scheme.
89 if (request->url().spec().find( 90 if (request->url().spec().find(
90 extension_urls::GetWebstoreItemDetailURLPrefix()) != 0) 91 extension_urls::GetWebstoreItemDetailURLPrefix()) != 0)
91 return NULL; 92 return NULL;
92 93
93 std::string app_id(request->url().ExtractFileName()); 94 std::string app_id(request->url().ExtractFileName());
94 if (!Extension::IdIsValid(app_id)) 95 if (!crx_file::id_util::IdIsValid(app_id))
95 return NULL; 96 return NULL;
96 97
97 return new navigation_interception::InterceptNavigationResourceThrottle( 98 return new navigation_interception::InterceptNavigationResourceThrottle(
98 request, 99 request,
99 base::Bind(&LaunchEphemeralApp, app_id)); 100 base::Bind(&LaunchEphemeralApp, app_id));
100 } 101 }
OLDNEW
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/apps/install_chrome_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698