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

Side by Side Diff: content/browser/tab_contents/tab_contents.cc

Issue 9150021: Rename WebUI to WebUIImpl. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/webui/generic_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/tab_contents/tab_contents.h" 5 #include "content/browser/tab_contents/tab_contents.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 13 matching lines...) Expand all
24 #include "content/browser/renderer_host/render_process_host_impl.h" 24 #include "content/browser/renderer_host/render_process_host_impl.h"
25 #include "content/browser/renderer_host/render_view_host.h" 25 #include "content/browser/renderer_host/render_view_host.h"
26 #include "content/browser/renderer_host/render_widget_host_view.h" 26 #include "content/browser/renderer_host/render_widget_host_view.h"
27 #include "content/browser/renderer_host/resource_dispatcher_host.h" 27 #include "content/browser/renderer_host/resource_dispatcher_host.h"
28 #include "content/browser/renderer_host/resource_request_details.h" 28 #include "content/browser/renderer_host/resource_request_details.h"
29 #include "content/browser/site_instance.h" 29 #include "content/browser/site_instance.h"
30 #include "content/browser/tab_contents/interstitial_page.h" 30 #include "content/browser/tab_contents/interstitial_page.h"
31 #include "content/browser/tab_contents/navigation_entry_impl.h" 31 #include "content/browser/tab_contents/navigation_entry_impl.h"
32 #include "content/browser/tab_contents/provisional_load_details.h" 32 #include "content/browser/tab_contents/provisional_load_details.h"
33 #include "content/browser/tab_contents/title_updated_details.h" 33 #include "content/browser/tab_contents/title_updated_details.h"
34 #include "content/browser/webui/web_ui_impl.h"
34 #include "content/common/intents_messages.h" 35 #include "content/common/intents_messages.h"
35 #include "content/common/view_messages.h" 36 #include "content/common/view_messages.h"
36 #include "content/public/browser/browser_context.h" 37 #include "content/public/browser/browser_context.h"
37 #include "content/public/browser/content_browser_client.h" 38 #include "content/public/browser/content_browser_client.h"
38 #include "content/public/browser/devtools_agent_host_registry.h" 39 #include "content/public/browser/devtools_agent_host_registry.h"
39 #include "content/public/browser/download_manager.h" 40 #include "content/public/browser/download_manager.h"
40 #include "content/public/browser/invalidate_type.h" 41 #include "content/public/browser/invalidate_type.h"
41 #include "content/public/browser/navigation_details.h" 42 #include "content/public/browser/navigation_details.h"
42 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
43 #include "content/public/browser/user_metrics.h" 44 #include "content/public/browser/user_metrics.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 using content::GlobalRequestID; 116 using content::GlobalRequestID;
116 using content::NavigationController; 117 using content::NavigationController;
117 using content::NavigationEntry; 118 using content::NavigationEntry;
118 using content::NavigationEntryImpl; 119 using content::NavigationEntryImpl;
119 using content::OpenURLParams; 120 using content::OpenURLParams;
120 using content::RenderViewHostDelegate; 121 using content::RenderViewHostDelegate;
121 using content::SSLStatus; 122 using content::SSLStatus;
122 using content::UserMetricsAction; 123 using content::UserMetricsAction;
123 using content::WebContents; 124 using content::WebContents;
124 using content::WebContentsObserver; 125 using content::WebContentsObserver;
126 using content::WebUI;
125 using content::WebUIController; 127 using content::WebUIController;
126 128
127 namespace { 129 namespace {
128 130
129 // Amount of time we wait between when a key event is received and the renderer 131 // Amount of time we wait between when a key event is received and the renderer
130 // is queried for its state and pushed to the NavigationEntry. 132 // is queried for its state and pushed to the NavigationEntry.
131 const int kQueryStateDelay = 5000; 133 const int kQueryStateDelay = 5000;
132 134
133 const int kSyncWaitDelay = 40; 135 const int kSyncWaitDelay = 40;
134 136
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 299
298 NavigationControllerImpl& TabContents::GetControllerImpl() { 300 NavigationControllerImpl& TabContents::GetControllerImpl() {
299 return controller_; 301 return controller_;
300 } 302 }
301 303
302 RenderViewHostManager* TabContents::GetRenderManagerForTesting() { 304 RenderViewHostManager* TabContents::GetRenderManagerForTesting() {
303 return &render_manager_; 305 return &render_manager_;
304 } 306 }
305 307
306 bool TabContents::OnMessageReceived(const IPC::Message& message) { 308 bool TabContents::OnMessageReceived(const IPC::Message& message) {
307 if (GetWebUI() && static_cast<WebUI*>(GetWebUI())->OnMessageReceived(message)) 309 if (GetWebUI() &&
310 static_cast<WebUIImpl*>(GetWebUI())->OnMessageReceived(message)) {
308 return true; 311 return true;
312 }
309 313
310 ObserverListBase<WebContentsObserver>::Iterator it(observers_); 314 ObserverListBase<WebContentsObserver>::Iterator it(observers_);
311 WebContentsObserver* observer; 315 WebContentsObserver* observer;
312 while ((observer = it.GetNext()) != NULL) 316 while ((observer = it.GetNext()) != NULL)
313 if (observer->OnMessageReceived(message)) 317 if (observer->OnMessageReceived(message))
314 return true; 318 return true;
315 319
316 bool handled = true; 320 bool handled = true;
317 bool message_is_ok = true; 321 bool message_is_ok = true;
318 IPC_BEGIN_MESSAGE_MAP_EX(TabContents, message, message_is_ok) 322 IPC_BEGIN_MESSAGE_MAP_EX(TabContents, message, message_is_ok)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 431
428 RenderWidgetHostView* TabContents::GetRenderWidgetHostView() const { 432 RenderWidgetHostView* TabContents::GetRenderWidgetHostView() const {
429 return render_manager_.GetRenderWidgetHostView(); 433 return render_manager_.GetRenderWidgetHostView();
430 } 434 }
431 435
432 content::WebContentsView* TabContents::GetView() const { 436 content::WebContentsView* TabContents::GetView() const {
433 return view_.get(); 437 return view_.get();
434 } 438 }
435 439
436 content::WebUI* TabContents::CreateWebUI(const GURL& url) { 440 content::WebUI* TabContents::CreateWebUI(const GURL& url) {
437 WebUI* web_ui = new WebUI(this); 441 WebUIImpl* web_ui = new WebUIImpl(this);
438 WebUIController* controller = 442 WebUIController* controller =
439 content::GetContentClient()->browser()->GetWebUIFactory()-> 443 content::GetContentClient()->browser()->GetWebUIFactory()->
440 CreateWebUIForURL(web_ui, url); 444 CreateWebUIForURL(web_ui, url);
441 if (controller) { 445 if (controller) {
442 web_ui->SetController(controller); 446 web_ui->SetController(controller);
443 return web_ui; 447 return web_ui;
444 } 448 }
445 449
446 delete web_ui; 450 delete web_ui;
447 return NULL; 451 return NULL;
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 } 1478 }
1475 1479
1476 void TabContents::DidNavigateMainFramePostCommit( 1480 void TabContents::DidNavigateMainFramePostCommit(
1477 const content::LoadCommittedDetails& details, 1481 const content::LoadCommittedDetails& details,
1478 const ViewHostMsg_FrameNavigate_Params& params) { 1482 const ViewHostMsg_FrameNavigate_Params& params) {
1479 if (opener_web_ui_type_ != WebUI::kNoWebUI) { 1483 if (opener_web_ui_type_ != WebUI::kNoWebUI) {
1480 // If this is a window.open navigation, use the same WebUI as the renderer 1484 // If this is a window.open navigation, use the same WebUI as the renderer
1481 // that opened the window, as long as both renderers have the same 1485 // that opened the window, as long as both renderers have the same
1482 // privileges. 1486 // privileges.
1483 if (delegate_ && opener_web_ui_type_ == GetWebUITypeForCurrentState()) { 1487 if (delegate_ && opener_web_ui_type_ == GetWebUITypeForCurrentState()) {
1484 WebUI* web_ui = static_cast<WebUI*>(CreateWebUI(GetURL())); 1488 WebUIImpl* web_ui = static_cast<WebUIImpl*>(CreateWebUI(GetURL()));
1485 // web_ui might be NULL if the URL refers to a non-existent extension. 1489 // web_ui might be NULL if the URL refers to a non-existent extension.
1486 if (web_ui) { 1490 if (web_ui) {
1487 render_manager_.SetWebUIPostCommit(web_ui); 1491 render_manager_.SetWebUIPostCommit(web_ui);
1488 web_ui->RenderViewCreated(GetRenderViewHost()); 1492 web_ui->RenderViewCreated(GetRenderViewHost());
1489 } 1493 }
1490 } 1494 }
1491 opener_web_ui_type_ = WebUI::kNoWebUI; 1495 opener_web_ui_type_ = WebUI::kNoWebUI;
1492 } 1496 }
1493 1497
1494 if (details.is_navigation_to_different_page()) { 1498 if (details.is_navigation_to_different_page()) {
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
2185 } 2189 }
2186 2190
2187 void TabContents::NotifySwappedFromRenderManager() { 2191 void TabContents::NotifySwappedFromRenderManager() {
2188 NotifySwapped(); 2192 NotifySwapped();
2189 } 2193 }
2190 2194
2191 NavigationControllerImpl& TabContents::GetControllerForRenderManager() { 2195 NavigationControllerImpl& TabContents::GetControllerForRenderManager() {
2192 return GetControllerImpl(); 2196 return GetControllerImpl();
2193 } 2197 }
2194 2198
2195 WebUI* TabContents::CreateWebUIForRenderManager(const GURL& url) { 2199 WebUIImpl* TabContents::CreateWebUIForRenderManager(const GURL& url) {
2196 return static_cast<WebUI*>(CreateWebUI(url)); 2200 return static_cast<WebUIImpl*>(CreateWebUI(url));
2197 } 2201 }
2198 2202
2199 NavigationEntry* 2203 NavigationEntry*
2200 TabContents::GetLastCommittedNavigationEntryForRenderManager() { 2204 TabContents::GetLastCommittedNavigationEntryForRenderManager() {
2201 return controller_.GetLastCommittedEntry(); 2205 return controller_.GetLastCommittedEntry();
2202 } 2206 }
2203 2207
2204 bool TabContents::CreateRenderViewForRenderManager( 2208 bool TabContents::CreateRenderViewForRenderManager(
2205 RenderViewHost* render_view_host) { 2209 RenderViewHost* render_view_host) {
2206 // Can be NULL during tests. 2210 // Can be NULL during tests.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 encoding_ = content::GetContentClient()->browser()-> 2260 encoding_ = content::GetContentClient()->browser()->
2257 GetCanonicalEncodingNameByAliasName(encoding); 2261 GetCanonicalEncodingNameByAliasName(encoding);
2258 } 2262 }
2259 2263
2260 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2264 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2261 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2265 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2262 // Can be NULL during tests. 2266 // Can be NULL during tests.
2263 if (rwh_view) 2267 if (rwh_view)
2264 rwh_view->SetSize(GetView()->GetContainerSize()); 2268 rwh_view->SetSize(GetView()->GetContainerSize());
2265 } 2269 }
OLDNEW
« no previous file with comments | « content/browser/tab_contents/tab_contents.h ('k') | content/browser/webui/generic_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698