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/extensions/extension_view_host_factory.h" | 5 #include "chrome/browser/extensions/extension_view_host_factory.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/extension_util.h" | 8 #include "chrome/browser/extensions/extension_util.h" |
9 #include "chrome/browser/extensions/extension_view_host.h" | 9 #include "chrome/browser/extensions/extension_view_host.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 | 77 |
78 // Returns the extension associated with |url| in |profile|. Returns NULL if | 78 // Returns the extension associated with |url| in |profile|. Returns NULL if |
79 // the extension does not exist. | 79 // the extension does not exist. |
80 const Extension* GetExtensionForUrl(Profile* profile, const GURL& url) { | 80 const Extension* GetExtensionForUrl(Profile* profile, const GURL& url) { |
81 ExtensionService* service = | 81 ExtensionService* service = |
82 ExtensionSystem::Get(profile)->extension_service(); | 82 ExtensionSystem::Get(profile)->extension_service(); |
83 if (!service) | 83 if (!service) |
84 return NULL; | 84 return NULL; |
85 std::string extension_id = url.host(); | 85 std::string extension_id = url.host(); |
86 if (url.SchemeIs(chrome::kChromeUIScheme) && | 86 if (url.SchemeIs(content::kChromeUIScheme) && |
87 url.host() == chrome::kChromeUIExtensionInfoHost) | 87 url.host() == chrome::kChromeUIExtensionInfoHost) |
88 extension_id = url.path().substr(1); | 88 extension_id = url.path().substr(1); |
89 return service->extensions()->GetByID(extension_id); | 89 return service->extensions()->GetByID(extension_id); |
90 } | 90 } |
91 | 91 |
92 // Creates and initializes an ExtensionViewHost for the extension with |url|. | 92 // Creates and initializes an ExtensionViewHost for the extension with |url|. |
93 ExtensionViewHost* CreateViewHost(const GURL& url, | 93 ExtensionViewHost* CreateViewHost(const GURL& url, |
94 Profile* profile, | 94 Profile* profile, |
95 Browser* browser, | 95 Browser* browser, |
96 extensions::ViewType view_type) { | 96 extensions::ViewType view_type) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 // static | 131 // static |
132 ExtensionViewHost* ExtensionViewHostFactory::CreateDialogHost( | 132 ExtensionViewHost* ExtensionViewHostFactory::CreateDialogHost( |
133 const GURL& url, | 133 const GURL& url, |
134 Profile* profile) { | 134 Profile* profile) { |
135 DCHECK(profile); | 135 DCHECK(profile); |
136 return CreateViewHost(url, profile, NULL, VIEW_TYPE_EXTENSION_DIALOG); | 136 return CreateViewHost(url, profile, NULL, VIEW_TYPE_EXTENSION_DIALOG); |
137 } | 137 } |
138 | 138 |
139 } // namespace extensions | 139 } // namespace extensions |
OLD | NEW |