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

Side by Side Diff: chrome/browser/extensions/extension_dom_ui.cc

Issue 5730004: Rename ExtensionsService to ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 10 years 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_dom_ui.h" 5 #include "chrome/browser/extensions/extension_dom_ui.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "net/base/file_stream.h" 10 #include "net/base/file_stream.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/browser_list.h" 13 #include "chrome/browser/browser_list.h"
14 #include "chrome/browser/extensions/extension_bookmark_manager_api.h" 14 #include "chrome/browser/extensions/extension_bookmark_manager_api.h"
15 #include "chrome/browser/extensions/extensions_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/image_loading_tracker.h" 16 #include "chrome/browser/extensions/image_loading_tracker.h"
17 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
18 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/renderer_host/render_widget_host_view.h" 19 #include "chrome/browser/renderer_host/render_widget_host_view.h"
20 #include "chrome/browser/tab_contents/tab_contents.h" 20 #include "chrome/browser/tab_contents/tab_contents.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/common/bindings_policy.h" 22 #include "chrome/common/bindings_policy.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/extensions/extension_constants.h" 24 #include "chrome/common/extensions/extension_constants.h"
25 #include "chrome/common/extensions/extension.h" 25 #include "chrome/common/extensions/extension.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 class ExtensionDOMUIImageLoadingTracker : public ImageLoadingTracker::Observer { 57 class ExtensionDOMUIImageLoadingTracker : public ImageLoadingTracker::Observer {
58 public: 58 public:
59 ExtensionDOMUIImageLoadingTracker(Profile* profile, 59 ExtensionDOMUIImageLoadingTracker(Profile* profile,
60 FaviconService::GetFaviconRequest* request, 60 FaviconService::GetFaviconRequest* request,
61 const GURL& page_url) 61 const GURL& page_url)
62 : ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)), 62 : ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)),
63 request_(request), 63 request_(request),
64 extension_(NULL) { 64 extension_(NULL) {
65 // Even when the extensions service is enabled by default, it's still 65 // Even when the extensions service is enabled by default, it's still
66 // disabled in incognito mode. 66 // disabled in incognito mode.
67 ExtensionsService* service = profile->GetExtensionsService(); 67 ExtensionService* service = profile->GetExtensionService();
68 if (service) 68 if (service)
69 extension_ = service->GetExtensionByURL(page_url); 69 extension_ = service->GetExtensionByURL(page_url);
70 } 70 }
71 71
72 void Init() { 72 void Init() {
73 if (extension_) { 73 if (extension_) {
74 ExtensionResource icon_resource = 74 ExtensionResource icon_resource =
75 extension_->GetIconResource(Extension::EXTENSION_ICON_BITTY, 75 extension_->GetIconResource(Extension::EXTENSION_ICON_BITTY,
76 ExtensionIconSet::MATCH_EXACTLY); 76 ExtensionIconSet::MATCH_EXACTLY);
77 77
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 }; 118 };
119 119
120 } // namespace 120 } // namespace
121 121
122 const char ExtensionDOMUI::kExtensionURLOverrides[] = 122 const char ExtensionDOMUI::kExtensionURLOverrides[] =
123 "extensions.chrome_url_overrides"; 123 "extensions.chrome_url_overrides";
124 124
125 ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents, const GURL& url) 125 ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents, const GURL& url)
126 : DOMUI(tab_contents), 126 : DOMUI(tab_contents),
127 url_(url) { 127 url_(url) {
128 ExtensionsService* service = tab_contents->profile()->GetExtensionsService(); 128 ExtensionService* service = tab_contents->profile()->GetExtensionService();
129 const Extension* extension = service->GetExtensionByURL(url); 129 const Extension* extension = service->GetExtensionByURL(url);
130 if (!extension) 130 if (!extension)
131 extension = service->GetExtensionByWebExtent(url); 131 extension = service->GetExtensionByWebExtent(url);
132 DCHECK(extension); 132 DCHECK(extension);
133 // Only hide the url for internal pages (e.g. chrome-extension or packaged 133 // Only hide the url for internal pages (e.g. chrome-extension or packaged
134 // component apps like bookmark manager. 134 // component apps like bookmark manager.
135 should_hide_url_ = !extension->is_hosted_app(); 135 should_hide_url_ = !extension->is_hosted_app();
136 136
137 bindings_ = BindingsPolicy::EXTENSION; 137 bindings_ = BindingsPolicy::EXTENSION;
138 // Bind externalHost to Extension DOMUI loaded in Chrome Frame. 138 // Bind externalHost to Extension DOMUI loaded in Chrome Frame.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 if (!url->SchemeIs(chrome::kChromeUIScheme)) 235 if (!url->SchemeIs(chrome::kChromeUIScheme))
236 return false; 236 return false;
237 237
238 const DictionaryValue* overrides = 238 const DictionaryValue* overrides =
239 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides); 239 profile->GetPrefs()->GetDictionary(kExtensionURLOverrides);
240 std::string page = url->host(); 240 std::string page = url->host();
241 ListValue* url_list; 241 ListValue* url_list;
242 if (!overrides || !overrides->GetList(page, &url_list)) 242 if (!overrides || !overrides->GetList(page, &url_list))
243 return false; 243 return false;
244 244
245 ExtensionsService* service = profile->GetExtensionsService(); 245 ExtensionService* service = profile->GetExtensionService();
246 246
247 size_t i = 0; 247 size_t i = 0;
248 while (i < url_list->GetSize()) { 248 while (i < url_list->GetSize()) {
249 Value* val = NULL; 249 Value* val = NULL;
250 url_list->Get(i, &val); 250 url_list->Get(i, &val);
251 251
252 // Verify that the override value is good. If not, unregister it and find 252 // Verify that the override value is good. If not, unregister it and find
253 // the next one. 253 // the next one.
254 std::string override; 254 std::string override;
255 if (!val->GetAsString(&override)) { 255 if (!val->GetAsString(&override)) {
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 } 400 }
401 401
402 // static 402 // static
403 void ExtensionDOMUI::GetFaviconForURL(Profile* profile, 403 void ExtensionDOMUI::GetFaviconForURL(Profile* profile,
404 FaviconService::GetFaviconRequest* request, const GURL& page_url) { 404 FaviconService::GetFaviconRequest* request, const GURL& page_url) {
405 // tracker deletes itself when done. 405 // tracker deletes itself when done.
406 ExtensionDOMUIImageLoadingTracker* tracker = 406 ExtensionDOMUIImageLoadingTracker* tracker =
407 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url); 407 new ExtensionDOMUIImageLoadingTracker(profile, request, page_url);
408 tracker->Init(); 408 tracker->Init();
409 } 409 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_disabled_infobar_delegate.cc ('k') | chrome/browser/extensions/extension_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698