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

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

Issue 9700023: Move creation of content TabContentsViews to content so that we can hide these headers through DEPS… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 9 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 "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 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "content/public/common/url_constants.h" 58 #include "content/public/common/url_constants.h"
59 #include "net/base/mime_util.h" 59 #include "net/base/mime_util.h"
60 #include "net/base/net_util.h" 60 #include "net/base/net_util.h"
61 #include "net/base/network_change_notifier.h" 61 #include "net/base/network_change_notifier.h"
62 #include "net/url_request/url_request_context_getter.h" 62 #include "net/url_request/url_request_context_getter.h"
63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 63 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
64 #include "ui/gfx/codec/png_codec.h" 64 #include "ui/gfx/codec/png_codec.h"
65 #include "webkit/glue/web_intent_data.h" 65 #include "webkit/glue/web_intent_data.h"
66 #include "webkit/glue/webpreferences.h" 66 #include "webkit/glue/webpreferences.h"
67 67
68 #if defined(OS_MACOSX) 68 #if defined(OS_WIN) && !defined(USE_AURA)
69 #include "content/browser/tab_contents/tab_contents_view_win.h"
70 #elif defined(TOOLKIT_GTK)
71 #include "content/browser/tab_contents/tab_contents_view_gtk.h"
72 #elif defined(OS_MACOSX)
73 #include "content/browser/tab_contents/web_contents_view_mac.h"
69 #include "ui/gfx/surface/io_surface_support_mac.h" 74 #include "ui/gfx/surface/io_surface_support_mac.h"
70 #endif // defined(OS_MACOSX) 75 #elif defined(OS_ANDROID)
76 #include "content/browser/tab_contents/web_contents_view_android.h"
77 #endif
71 78
72 // Cross-Site Navigations 79 // Cross-Site Navigations
73 // 80 //
74 // If a TabContents is told to navigate to a different web site (as determined 81 // If a TabContents is told to navigate to a different web site (as determined
75 // by SiteInstance), it will replace its current RenderViewHost with a new 82 // by SiteInstance), it will replace its current RenderViewHost with a new
76 // RenderViewHost dedicated to the new SiteInstance. This works as follows: 83 // RenderViewHost dedicated to the new SiteInstance. This works as follows:
77 // 84 //
78 // - Navigate determines whether the destination is cross-site, and if so, 85 // - Navigate determines whether the destination is cross-site, and if so,
79 // it creates a pending_render_view_host_. 86 // it creates a pending_render_view_host_.
80 // - The pending RVH is "suspended," so that no navigation messages are sent to 87 // - The pending RVH is "suspended," so that no navigation messages are sent to
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // TabContents ---------------------------------------------------------------- 239 // TabContents ----------------------------------------------------------------
233 240
234 TabContents::TabContents(content::BrowserContext* browser_context, 241 TabContents::TabContents(content::BrowserContext* browser_context,
235 SiteInstance* site_instance, 242 SiteInstance* site_instance,
236 int routing_id, 243 int routing_id,
237 const TabContents* base_tab_contents, 244 const TabContents* base_tab_contents,
238 SessionStorageNamespaceImpl* session_storage_namespace) 245 SessionStorageNamespaceImpl* session_storage_namespace)
239 : delegate_(NULL), 246 : delegate_(NULL),
240 ALLOW_THIS_IN_INITIALIZER_LIST(controller_( 247 ALLOW_THIS_IN_INITIALIZER_LIST(controller_(
241 this, browser_context, session_storage_namespace)), 248 this, browser_context, session_storage_namespace)),
242 ALLOW_THIS_IN_INITIALIZER_LIST(view_(
243 content::GetContentClient()->browser()->CreateWebContentsView(this))),
244 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)), 249 ALLOW_THIS_IN_INITIALIZER_LIST(render_manager_(this, this)),
245 is_loading_(false), 250 is_loading_(false),
246 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING), 251 crashed_status_(base::TERMINATION_STATUS_STILL_RUNNING),
247 crashed_error_code_(0), 252 crashed_error_code_(0),
248 waiting_for_response_(false), 253 waiting_for_response_(false),
249 load_state_(net::LOAD_STATE_IDLE, string16()), 254 load_state_(net::LOAD_STATE_IDLE, string16()),
250 upload_size_(0), 255 upload_size_(0),
251 upload_position_(0), 256 upload_position_(0),
252 displayed_insecure_content_(false), 257 displayed_insecure_content_(false),
253 capturing_contents_(false), 258 capturing_contents_(false),
254 is_being_destroyed_(false), 259 is_being_destroyed_(false),
255 notify_disconnection_(false), 260 notify_disconnection_(false),
256 dialog_creator_(NULL), 261 dialog_creator_(NULL),
257 #if defined(OS_WIN) 262 #if defined(OS_WIN)
258 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)), 263 message_box_active_(CreateEvent(NULL, TRUE, FALSE, NULL)),
259 #endif 264 #endif
260 is_showing_before_unload_dialog_(false), 265 is_showing_before_unload_dialog_(false),
261 opener_web_ui_type_(WebUI::kNoWebUI), 266 opener_web_ui_type_(WebUI::kNoWebUI),
262 closed_by_user_gesture_(false), 267 closed_by_user_gesture_(false),
263 minimum_zoom_percent_( 268 minimum_zoom_percent_(
264 static_cast<int>(content::kMinimumZoomFactor * 100)), 269 static_cast<int>(content::kMinimumZoomFactor * 100)),
265 maximum_zoom_percent_( 270 maximum_zoom_percent_(
266 static_cast<int>(content::kMaximumZoomFactor * 100)), 271 static_cast<int>(content::kMaximumZoomFactor * 100)),
267 temporary_zoom_settings_(false), 272 temporary_zoom_settings_(false),
268 content_restrictions_(0), 273 content_restrictions_(0),
269 view_type_(content::VIEW_TYPE_TAB_CONTENTS), 274 view_type_(content::VIEW_TYPE_TAB_CONTENTS),
270 has_opener_(false) { 275 has_opener_(false) {
271 render_manager_.Init(browser_context, site_instance, routing_id); 276 render_manager_.Init(browser_context, site_instance, routing_id);
272 277
278 view_.reset(content::GetContentClient()->browser()->
279 OverrideCreateWebContentsView(this));
280 if (!view_.get()) {
281 content::WebContentsViewDelegate* delegate =
282 content::GetContentClient()->browser()->GetWebContentsViewDelegate(
283 this);
284 #if defined(OS_WIN) && !defined(USE_AURA)
285 view_.reset(new TabContentsViewWin(this, delegate));
286 #elif defined(TOOLKIT_GTK)
287 view_.reset(new content::TabContentsViewGtk(this, delegate));
288 #elif defined(OS_MACOSX)
289 view_.reset(web_contents_view_mac::CreateWebContentsView(this, delegate));
290 #elif defined(OS_ANDROID)
291 view_.reset(new WebContentsViewAndroid(this));
292 #endif
293 }
294 CHECK(view_.get());
295
273 // We have the initial size of the view be based on the size of the passed in 296 // We have the initial size of the view be based on the size of the passed in
274 // tab contents (normally a tab from the same window). 297 // tab contents (normally a tab from the same window).
275 view_->CreateView(base_tab_contents ? 298 view_->CreateView(base_tab_contents ?
276 base_tab_contents->GetView()->GetContainerSize() : gfx::Size()); 299 base_tab_contents->GetView()->GetContainerSize() : gfx::Size());
277 300
278 #if defined(ENABLE_JAVA_BRIDGE) 301 #if defined(ENABLE_JAVA_BRIDGE)
279 java_bridge_dispatcher_host_manager_.reset( 302 java_bridge_dispatcher_host_manager_.reset(
280 new JavaBridgeDispatcherHostManager(this)); 303 new JavaBridgeDispatcherHostManager(this));
281 #endif 304 #endif
282 } 305 }
(...skipping 2220 matching lines...) Expand 10 before | Expand all | Expand 10 after
2503 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { 2526 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) {
2504 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); 2527 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh);
2505 // Can be NULL during tests. 2528 // Can be NULL during tests.
2506 if (rwh_view) 2529 if (rwh_view)
2507 rwh_view->SetSize(GetView()->GetContainerSize()); 2530 rwh_view->SetSize(GetView()->GetContainerSize());
2508 } 2531 }
2509 2532
2510 RenderViewHostImpl* TabContents::GetRenderViewHostImpl() { 2533 RenderViewHostImpl* TabContents::GetRenderViewHostImpl() {
2511 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); 2534 return static_cast<RenderViewHostImpl*>(GetRenderViewHost());
2512 } 2535 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698