OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/extensions/extension_set.h" | 5 #include "chrome/common/extensions/extension_set.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 | 9 |
10 ExtensionSet::ExtensionSet() { | 10 ExtensionSet::ExtensionSet() { |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 return extension->id(); | 40 return extension->id(); |
41 } | 41 } |
42 | 42 |
43 const Extension* ExtensionSet::GetByURL(const GURL& url) const { | 43 const Extension* ExtensionSet::GetByURL(const GURL& url) const { |
44 if (url.SchemeIs(chrome::kExtensionScheme)) | 44 if (url.SchemeIs(chrome::kExtensionScheme)) |
45 return GetByID(url.host()); | 45 return GetByID(url.host()); |
46 | 46 |
47 ExtensionMap::const_iterator i = extensions_.begin(); | 47 ExtensionMap::const_iterator i = extensions_.begin(); |
48 for (; i != extensions_.end(); ++i) { | 48 for (; i != extensions_.end(); ++i) { |
49 if (i->second->web_extent().MatchesURL(url)) | 49 // Exclude bookmark apps so that they do not affect the process model. |
| 50 // TODO(creis): Where is the right place to do this exclusion? |
| 51 if (i->second->web_extent().MatchesURL(url) && |
| 52 !i->second->from_bookmark()) { |
50 return i->second.get(); | 53 return i->second.get(); |
| 54 } |
51 } | 55 } |
52 | 56 |
53 return NULL; | 57 return NULL; |
54 } | 58 } |
55 | 59 |
56 bool ExtensionSet::InSameExtent(const GURL& old_url, | 60 bool ExtensionSet::InSameExtent(const GURL& old_url, |
57 const GURL& new_url) const { | 61 const GURL& new_url) const { |
58 return GetByURL(old_url) == GetByURL(new_url); | 62 return GetByURL(old_url) == GetByURL(new_url); |
59 } | 63 } |
60 | 64 |
(...skipping 11 matching lines...) Expand all Loading... |
72 | 76 |
73 ExtensionMap::const_iterator i = extensions_.begin(); | 77 ExtensionMap::const_iterator i = extensions_.begin(); |
74 for (; i != extensions_.end(); ++i) { | 78 for (; i != extensions_.end(); ++i) { |
75 if (i->second->location() == Extension::COMPONENT && | 79 if (i->second->location() == Extension::COMPONENT && |
76 i->second->web_extent().MatchesURL(url)) | 80 i->second->web_extent().MatchesURL(url)) |
77 return true; | 81 return true; |
78 } | 82 } |
79 | 83 |
80 return false; | 84 return false; |
81 } | 85 } |
OLD | NEW |