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

Side by Side Diff: chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc

Issue 10534098: TabContentsWrapper -> TabContents, part 51. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/chrome_web_ui_controller_factory.h" 5 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/about_flags.h" 8 #include "chrome/browser/about_flags.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
11 #include "chrome/browser/extensions/extension_web_ui.h" 11 #include "chrome/browser/extensions/extension_web_ui.h"
12 #include "chrome/browser/history/history_types.h" 12 #include "chrome/browser/history/history_types.h"
13 #include "chrome/browser/prefs/pref_service.h" 13 #include "chrome/browser/prefs/pref_service.h"
14 #include "chrome/browser/printing/print_preview_tab_controller.h" 14 #include "chrome/browser/printing/print_preview_tab_controller.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/profiles/profile_manager.h" 16 #include "chrome/browser/profiles/profile_manager.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 17 #include "chrome/browser/ui/tab_contents/tab_contents.h"
18 #include "chrome/browser/ui/webui/about_ui.h" 18 #include "chrome/browser/ui/webui/about_ui.h"
19 #include "chrome/browser/ui/webui/bookmarks_ui.h" 19 #include "chrome/browser/ui/webui/bookmarks_ui.h"
20 #include "chrome/browser/ui/webui/crashes_ui.h" 20 #include "chrome/browser/ui/webui/crashes_ui.h"
21 #include "chrome/browser/ui/webui/devtools_ui.h" 21 #include "chrome/browser/ui/webui/devtools_ui.h"
22 #include "chrome/browser/ui/webui/downloads_ui.h" 22 #include "chrome/browser/ui/webui/downloads_ui.h"
23 #include "chrome/browser/ui/webui/extensions/extension_activity_ui.h" 23 #include "chrome/browser/ui/webui/extensions/extension_activity_ui.h"
24 #include "chrome/browser/ui/webui/extensions/extensions_ui.h" 24 #include "chrome/browser/ui/webui/extensions/extensions_ui.h"
25 #include "chrome/browser/ui/webui/feedback_ui.h" 25 #include "chrome/browser/ui/webui/feedback_ui.h"
26 #include "chrome/browser/ui/webui/flags_ui.h" 26 #include "chrome/browser/ui/webui/flags_ui.h"
27 #include "chrome/browser/ui/webui/flash_ui.h" 27 #include "chrome/browser/ui/webui/flash_ui.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 return new ExtensionWebUI(web_ui, url); 109 return new ExtensionWebUI(web_ui, url);
110 } 110 }
111 111
112 // Special case for older about: handlers. 112 // Special case for older about: handlers.
113 template<> 113 template<>
114 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) { 114 WebUIController* NewWebUI<AboutUI>(WebUI* web_ui, const GURL& url) {
115 return new AboutUI(web_ui, url.host()); 115 return new AboutUI(web_ui, url.host());
116 } 116 }
117 117
118 // Only create ExtensionWebUI for URLs that are allowed extension bindings, 118 // Only create ExtensionWebUI for URLs that are allowed extension bindings,
119 // hosted by actual tabs. If tab_contents has no wrapper, it likely refers 119 // hosted by actual tabs. If there is no TabContents, it likely refers
120 // to another container type, like an extension background page. If there is 120 // to another container type, like an extension background page. If there is
121 // no WebUI (it's not accessible when calling GetWebUIType and related 121 // no WebUI (it's not accessible when calling GetWebUIType and related
122 // functions) then we conservatively assume that we need a WebUI. 122 // functions) then we conservatively assume that we need a WebUI.
123 bool NeedsExtensionWebUI(WebUI* web_ui, 123 bool NeedsExtensionWebUI(WebUI* web_ui,
124 Profile* profile, 124 Profile* profile,
125 const GURL& url) { 125 const GURL& url) {
126 ExtensionService* service = profile ? profile->GetExtensionService() : NULL; 126 ExtensionService* service = profile ? profile->GetExtensionService() : NULL;
127 return service && service->ExtensionBindingsAllowed(url) && 127 return service && service->ExtensionBindingsAllowed(url) &&
128 (!web_ui || 128 (!web_ui || TabContents::FromWebContents(web_ui->GetWebContents()));
129 TabContentsWrapper::GetCurrentWrapperForContents(
130 web_ui->GetWebContents()));
131 } 129 }
132 130
133 // Returns a function that can be used to create the right type of WebUI for a 131 // Returns a function that can be used to create the right type of WebUI for a
134 // tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated 132 // tab, based on its URL. Returns NULL if the URL doesn't have WebUI associated
135 // with it. 133 // with it.
136 WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, 134 WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui,
137 Profile* profile, 135 Profile* profile,
138 const GURL& url) { 136 const GURL& url) {
139 if (NeedsExtensionWebUI(web_ui, profile, url)) 137 if (NeedsExtensionWebUI(web_ui, profile, url))
140 return &NewWebUI<ExtensionWebUI>; 138 return &NewWebUI<ExtensionWebUI>;
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 if (page_url.host() == chrome::kChromeUISettingsFrameHost) 500 if (page_url.host() == chrome::kChromeUISettingsFrameHost)
503 return options2::OptionsUI::GetFaviconResourceBytes(); 501 return options2::OptionsUI::GetFaviconResourceBytes();
504 502
505 // Android doesn't use the plugins pages. 503 // Android doesn't use the plugins pages.
506 if (page_url.host() == chrome::kChromeUIPluginsHost) 504 if (page_url.host() == chrome::kChromeUIPluginsHost)
507 return PluginsUI::GetFaviconResourceBytes(); 505 return PluginsUI::GetFaviconResourceBytes();
508 #endif 506 #endif
509 507
510 return NULL; 508 return NULL;
511 } 509 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/certificate_viewer_webui.cc ('k') | chrome/browser/ui/webui/constrained_web_dialog_delegate_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698