diff options
author | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 15:29:03 +0000 |
---|---|---|
committer | brettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-17 15:29:03 +0000 |
commit | 15787f8f3946a513d39a1f0d9a12925f447fa18d (patch) | |
tree | 9f68bab4d2682376d7d11ec42024f67823470427 /chrome/browser/web_contents_view.cc | |
parent | 0d05594d912d67dcbcd5b899a1036819603922b1 (diff) | |
download | chromium_src-15787f8f3946a513d39a1f0d9a12925f447fa18d.zip chromium_src-15787f8f3946a513d39a1f0d9a12925f447fa18d.tar.gz chromium_src-15787f8f3946a513d39a1f0d9a12925f447fa18d.tar.bz2 |
Separate out most view creation from WebContents. This adds a new sub-delegate to RenderViewHostDelegate which is implemented by WebContentsView. I did a lot of plumbing and moving around as a result.
Review URL: http://codereview.chromium.org/6608
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3527 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/web_contents_view.cc')
-rw-r--r-- | chrome/browser/web_contents_view.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/chrome/browser/web_contents_view.cc b/chrome/browser/web_contents_view.cc new file mode 100644 index 0000000..28dd88b --- /dev/null +++ b/chrome/browser/web_contents_view.cc @@ -0,0 +1,47 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/web_contents_view.h" + +void WebContentsView::CreateNewWindow(int route_id, HANDLE modal_dialog_event) { + // Save the created window associated with the route so we can show it later. + pending_contents_[route_id] = CreateNewWindowInternal(route_id, + modal_dialog_event); +} + +void WebContentsView::CreateNewWidget(int route_id) { + // Save the created widget associated with the route so we can show it later. + pending_widget_views_[route_id] = CreateNewWidgetInternal(route_id); +} + +void WebContentsView::ShowCreatedWindow(int route_id, + WindowOpenDisposition disposition, + const gfx::Rect& initial_pos, + bool user_gesture) { + PendingContents::iterator iter = pending_contents_.find(route_id); + if (iter == pending_contents_.end()) { + DCHECK(false); + return; + } + + WebContents* new_web_contents = iter->second; + pending_contents_.erase(route_id); + + ShowCreatedWindowInternal(new_web_contents, disposition, initial_pos, + user_gesture); +} + +void WebContentsView::ShowCreatedWidget(int route_id, + const gfx::Rect& initial_pos) { + PendingWidgetViews::iterator iter = pending_widget_views_.find(route_id); + if (iter == pending_widget_views_.end()) { + DCHECK(false); + return; + } + + RenderWidgetHostView* widget_host_view = iter->second; + pending_widget_views_.erase(route_id); + + ShowCreatedWidgetInternal(widget_host_view, initial_pos); +} |