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

Side by Side Diff: extensions/common/extension_set.cc

Issue 218683011: Remove ExtensionService::[Get|Is]InstalledApp() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dc_ces_get_installed_ext_by_url
Patch Set: Created 6 years, 8 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
« no previous file with comments | « extensions/common/extension_set.h ('k') | no next file » | 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 "extensions/common/extension_set.h" 5 #include "extensions/common/extension_set.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "extensions/common/constants.h" 10 #include "extensions/common/constants.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return extension->id(); 82 return extension->id();
83 } 83 }
84 84
85 const Extension* ExtensionSet::GetExtensionOrAppByURL(const GURL& url) const { 85 const Extension* ExtensionSet::GetExtensionOrAppByURL(const GURL& url) const {
86 if (url.SchemeIs(kExtensionScheme)) 86 if (url.SchemeIs(kExtensionScheme))
87 return GetByID(url.host()); 87 return GetByID(url.host());
88 88
89 return GetHostedAppByURL(url); 89 return GetHostedAppByURL(url);
90 } 90 }
91 91
92 const Extension* ExtensionSet::GetAppByURL(const GURL& url) const {
93 const Extension* extension = GetExtensionOrAppByURL(url);
94 return (extension && extension->is_app()) ? extension : NULL;
95 }
96
92 const Extension* ExtensionSet::GetHostedAppByURL(const GURL& url) const { 97 const Extension* ExtensionSet::GetHostedAppByURL(const GURL& url) const {
93 for (ExtensionMap::const_iterator iter = extensions_.begin(); 98 for (ExtensionMap::const_iterator iter = extensions_.begin();
94 iter != extensions_.end(); ++iter) { 99 iter != extensions_.end(); ++iter) {
95 if (iter->second->web_extent().MatchesURL(url)) 100 if (iter->second->web_extent().MatchesURL(url))
96 return iter->second.get(); 101 return iter->second.get();
97 } 102 }
98 103
99 return NULL; 104 return NULL;
100 } 105 }
101 106
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 it != extensions_.end(); ++it) { 146 it != extensions_.end(); ++it) {
142 if (it->second->location() == Manifest::COMPONENT && 147 if (it->second->location() == Manifest::COMPONENT &&
143 it->second->web_extent().MatchesURL(url)) 148 it->second->web_extent().MatchesURL(url))
144 return true; 149 return true;
145 } 150 }
146 151
147 return false; 152 return false;
148 } 153 }
149 154
150 } // namespace extensions 155 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/common/extension_set.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698