diff options
-rw-r--r-- | chrome/browser/browser.cc | 15 | ||||
-rw-r--r-- | chrome/browser/debugger/debugger_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/external_tab_container.cc | 3 | ||||
-rw-r--r-- | chrome/browser/navigation_controller.cc | 22 | ||||
-rw-r--r-- | chrome/browser/navigation_controller.h | 12 | ||||
-rw-r--r-- | chrome/browser/tab_contents.h | 3 | ||||
-rw-r--r-- | chrome/browser/tab_contents_factory.cc | 3 | ||||
-rw-r--r-- | chrome/browser/views/dom_view.cc | 4 | ||||
-rw-r--r-- | chrome/browser/web_contents.cc | 5 | ||||
-rw-r--r-- | chrome/browser/web_contents.h | 2 | ||||
-rw-r--r-- | chrome/browser/web_contents_view.h | 3 | ||||
-rw-r--r-- | chrome/browser/web_contents_view_win.cc | 13 | ||||
-rw-r--r-- | chrome/browser/web_contents_view_win.h | 3 |
13 files changed, 32 insertions, 60 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index 142ef6f..7c8542c 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -1235,9 +1235,7 @@ TabContents* Browser::CreateTabContentsForURL( TabContentsType type = TabContents::TypeForURL(&real_url); DCHECK(type != TAB_CONTENTS_UNKNOWN_TYPE); - HWND parent_hwnd = reinterpret_cast<HWND>(window_->GetNativeHandle()); - TabContents* contents = TabContents::CreateWithType(type, parent_hwnd, - profile, instance); + TabContents* contents = TabContents::CreateWithType(type, profile, instance); contents->SetupController(profile); if (!defer_load) { @@ -1265,9 +1263,7 @@ void Browser::DuplicateContentsAt(int index) { if (type_ == BrowserType::TABBED_BROWSER) { // If this is a tabbed browser, just create a duplicate tab inside the same // window next to the tab being duplicated. - HWND parent_hwnd = reinterpret_cast<HWND>(window_->GetNativeHandle()); - new_contents = contents->controller()->Clone( - parent_hwnd)->active_contents(); + new_contents = contents->controller()->Clone()->active_contents(); // If you duplicate a tab that is not selected, we need to make sure to // select the tab being duplicated so that DetermineInsertionIndex returns // the right index (if tab 5 is selected and we right-click tab 1 we want @@ -1289,9 +1285,8 @@ void Browser::DuplicateContentsAt(int index) { browser->window()->Show(); // The page transition below is only for the purpose of inserting the tab. - HWND parent_hwnd = reinterpret_cast<HWND>(window_->GetNativeHandle()); new_contents = browser->AddTabWithNavigationController( - contents->controller()->Clone(parent_hwnd), + contents->controller()->Clone(), PageTransition::LINK); } @@ -2193,9 +2188,7 @@ NavigationController* Browser::BuildRestoredNavigationController( // Create a NavigationController. This constructor creates the appropriate // set of TabContents. - HWND parent_hwnd = reinterpret_cast<HWND>(window_->GetNativeHandle()); - return new NavigationController( - profile_, navigations, selected_navigation, parent_hwnd); + return new NavigationController(profile_, navigations, selected_navigation); } else { // No navigations. Create a tab with about:blank. TabContents* contents = diff --git a/chrome/browser/debugger/debugger_view.cc b/chrome/browser/debugger/debugger_view.cc index 127c987..169be19 100644 --- a/chrome/browser/debugger/debugger_view.cc +++ b/chrome/browser/debugger/debugger_view.cc @@ -92,8 +92,8 @@ void DebuggerView::OnInit() { // We can't create the WebContents until we've actually been put into a real // view hierarchy somewhere. Profile* profile = BrowserList::GetLastActive()->profile(); - TabContents* tc = TabContents::CreateWithType(TAB_CONTENTS_DEBUGGER, - ::GetDesktopWindow(), profile, NULL); + TabContents* tc = TabContents::CreateWithType(TAB_CONTENTS_DEBUGGER, profile, + NULL); web_contents_ = tc->AsWebContents(); web_contents_->SetupController(profile); web_contents_->set_delegate(this); diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc index ea1f7e3..62aec65 100644 --- a/chrome/browser/external_tab_container.cc +++ b/chrome/browser/external_tab_container.cc @@ -57,8 +57,7 @@ bool ExternalTabContainer::Init(Profile* profile) { views::FocusManager::CreateFocusManager(m_hWnd, GetRootView()); DCHECK(focus_manager); focus_manager->AddKeystrokeListener(this); - tab_contents_ = TabContents::CreateWithType(TAB_CONTENTS_WEB, - m_hWnd, profile, NULL); + tab_contents_ = TabContents::CreateWithType(TAB_CONTENTS_WEB, profile, NULL); if (!tab_contents_) { NOTREACHED(); DestroyWindow(); diff --git a/chrome/browser/navigation_controller.cc b/chrome/browser/navigation_controller.cc index 9f9cf68..123530f 100644 --- a/chrome/browser/navigation_controller.cc +++ b/chrome/browser/navigation_controller.cc @@ -183,8 +183,7 @@ NavigationController::NavigationController(TabContents* contents, NavigationController::NavigationController( Profile* profile, const std::vector<TabNavigation>& navigations, - int selected_navigation, - HWND parent) + int selected_navigation) : profile_(profile), pending_entry_(NULL), last_committed_entry_index_(-1), @@ -203,7 +202,7 @@ NavigationController::NavigationController( CreateNavigationEntriesFromTabNavigations(navigations, &entries_); // And finish the restore. - FinishRestore(parent, selected_navigation); + FinishRestore(selected_navigation); } NavigationController::~NavigationController() { @@ -1023,10 +1022,7 @@ void NavigationController::NavigateToPendingEntry(bool reload) { if (from_contents && from_contents->type() != pending_entry_->tab_type()) from_contents->set_is_active(false); - HWND parent = - from_contents ? GetParent(from_contents->GetContainerHWND()) : 0; - TabContents* contents = - GetTabContentsCreateIfNecessary(parent, *pending_entry_); + TabContents* contents = GetTabContentsCreateIfNecessary(*pending_entry_); contents->set_is_active(true); active_contents_ = contents; @@ -1058,11 +1054,10 @@ void NavigationController::NotifyNavigationEntryCommitted( } TabContents* NavigationController::GetTabContentsCreateIfNecessary( - HWND parent, const NavigationEntry& entry) { TabContents* contents = GetTabContents(entry.tab_type()); if (!contents) { - contents = TabContents::CreateWithType(entry.tab_type(), parent, profile_, + contents = TabContents::CreateWithType(entry.tab_type(), profile_, entry.site_instance()); if (!contents->AsWebContents()) { // Update the max page id, otherwise the newly created TabContents may @@ -1142,7 +1137,7 @@ void NavigationController::NotifyEntryChanged(const NavigationEntry* entry, Details<EntryChangedDetails>(&det)); } -NavigationController* NavigationController::Clone(HWND parent_hwnd) { +NavigationController* NavigationController::Clone() { NavigationController* nc = new NavigationController(NULL, profile_); if (GetEntryCount() == 0) @@ -1156,7 +1151,7 @@ NavigationController* NavigationController::Clone(HWND parent_hwnd) { new NavigationEntry(*GetEntryAtIndex(i)))); } - nc->FinishRestore(parent_hwnd, last_committed_entry_index_); + nc->FinishRestore(last_committed_entry_index_); return nc; } @@ -1202,7 +1197,7 @@ void NavigationController::CancelTabContentsCollection(TabContentsType t) { } } -void NavigationController::FinishRestore(HWND parent_hwnd, int selected_index) { +void NavigationController::FinishRestore(int selected_index) { DCHECK(selected_index >= 0 && selected_index < GetEntryCount()); ConfigureEntriesForRestore(&entries_); @@ -1211,8 +1206,7 @@ void NavigationController::FinishRestore(HWND parent_hwnd, int selected_index) { last_committed_entry_index_ = selected_index; // Callers assume we have an active_contents after restoring, so set it now. - active_contents_ = - GetTabContentsCreateIfNecessary(parent_hwnd, *entries_[selected_index]); + active_contents_ = GetTabContentsCreateIfNecessary(*entries_[selected_index]); } void NavigationController::DiscardNonCommittedEntriesInternal() { diff --git a/chrome/browser/navigation_controller.h b/chrome/browser/navigation_controller.h index 5b5408f..ba805bd 100644 --- a/chrome/browser/navigation_controller.h +++ b/chrome/browser/navigation_controller.h @@ -128,8 +128,7 @@ class NavigationController { NavigationController( Profile* profile, const std::vector<TabNavigation>& navigations, - int selected_navigation, - HWND parent); + int selected_navigation); ~NavigationController(); // Begin the destruction sequence for this NavigationController and all its @@ -141,8 +140,8 @@ class NavigationController { void Destroy(); // Clone the receiving navigation controller. Only the active tab contents is - // duplicated. It is created as a child of the provided HWND. - NavigationController* Clone(HWND hwnd); + // duplicated. + NavigationController* Clone(); // Returns the profile for this controller. It can never be NULL. Profile* profile() const { @@ -434,8 +433,7 @@ class NavigationController { // Returns the TabContents for the |entry|'s type. If the TabContents // doesn't yet exist, it is created. If a new TabContents is created, its // parent is |parent|. Becomes part of |entry|'s SiteInstance. - TabContents* GetTabContentsCreateIfNecessary(HWND parent, - const NavigationEntry& entry); + TabContents* GetTabContentsCreateIfNecessary(const NavigationEntry& entry); // Register the provided tab contents. This tab contents will be owned // and deleted by this navigation controller @@ -463,7 +461,7 @@ class NavigationController { // Invoked after session/tab restore or cloning a tab. Resets the transition // type of the entries, updates the max page id and creates the active // contents. - void FinishRestore(HWND parent_hwnd, int selected_index); + void FinishRestore(int selected_index); // Inserts an entry after the current position, removing all entries after it. // The new entry will become the active one. diff --git a/chrome/browser/tab_contents.h b/chrome/browser/tab_contents.h index 6f7f592..ebbc47b 100644 --- a/chrome/browser/tab_contents.h +++ b/chrome/browser/tab_contents.h @@ -75,7 +75,6 @@ class TabContents : public PageNavigator { // Creates a new TabContents of the given type. Will reuse the given // instance's renderer, if it is not null. static TabContents* CreateWithType(TabContentsType type, - HWND parent, Profile* profile, SiteInstance* instance); @@ -340,7 +339,7 @@ class TabContents : public PageNavigator { // Tell the subclass to set up the view (e.g. create the container HWND if // applicable) and any other create-time setup. - virtual void CreateView(HWND parent_hwnd, const gfx::Rect& initial_bounds) {} + virtual void CreateView() {} // Returns the HWND associated with this TabContents. Outside of automation // in the context of the UI, this is required to be implemented. diff --git a/chrome/browser/tab_contents_factory.cc b/chrome/browser/tab_contents_factory.cc index 19b40569..2488222 100644 --- a/chrome/browser/tab_contents_factory.cc +++ b/chrome/browser/tab_contents_factory.cc @@ -38,7 +38,6 @@ TabContentsType TabContentsFactory::NextUnusedType() { /*static*/ TabContents* TabContents::CreateWithType(TabContentsType type, - HWND parent, Profile* profile, SiteInstance* instance) { TabContents* contents; @@ -89,7 +88,7 @@ TabContents* TabContents::CreateWithType(TabContentsType type, } if (contents) - contents->CreateView(parent, gfx::Rect()); + contents->CreateView(); return contents; } diff --git a/chrome/browser/views/dom_view.cc b/chrome/browser/views/dom_view.cc index ebb63e3..ba74fac 100644 --- a/chrome/browser/views/dom_view.cc +++ b/chrome/browser/views/dom_view.cc @@ -28,8 +28,8 @@ bool DOMView::Init(Profile* profile, SiteInstance* instance) { // a DOMUIHostFactory rather than TabContentsFactory, because DOMView's // should only be associated with instances of DOMUIHost. TabContentsType type = TabContents::TypeForURL(&contents_); - TabContents* tab_contents = TabContents::CreateWithType(type, - GetContainer()->GetHWND(), profile, instance); + TabContents* tab_contents = TabContents::CreateWithType(type, profile, + instance); host_ = tab_contents->AsDOMUIHost(); DCHECK(host_); diff --git a/chrome/browser/web_contents.cc b/chrome/browser/web_contents.cc index dda65e1..a8fe7db 100644 --- a/chrome/browser/web_contents.cc +++ b/chrome/browser/web_contents.cc @@ -481,9 +481,8 @@ void WebContents::SetDownloadShelfVisible(bool visible) { } // Stupid view pass-throughs -void WebContents::CreateView(HWND parent_hwnd, - const gfx::Rect& initial_bounds) { - view_->CreateView(parent_hwnd, initial_bounds); +void WebContents::CreateView() { + view_->CreateView(); } HWND WebContents::GetContainerHWND() const { return view_->GetContainerHWND(); diff --git a/chrome/browser/web_contents.h b/chrome/browser/web_contents.h index 8b59d6b..71894de 100644 --- a/chrome/browser/web_contents.h +++ b/chrome/browser/web_contents.h @@ -103,7 +103,7 @@ class WebContents : public TabContents, // Retarded pass-throughs to the view. // TODO(brettw) fix this, tab contents shouldn't have these methods, probably // it should be killed altogether. - virtual void CreateView(HWND parent_hwnd, const gfx::Rect& initial_bounds); + virtual void CreateView(); virtual HWND GetContainerHWND() const; virtual HWND GetContentHWND(); virtual void GetContainerBounds(gfx::Rect *out) const; diff --git a/chrome/browser/web_contents_view.h b/chrome/browser/web_contents_view.h index e6b24c2..c253a7d 100644 --- a/chrome/browser/web_contents_view.h +++ b/chrome/browser/web_contents_view.h @@ -38,8 +38,7 @@ class WebContentsView : public RenderViewHostDelegate::View { virtual WebContents* GetWebContents() = 0; - virtual void CreateView(HWND parent_hwnd, - const gfx::Rect& initial_bounds) = 0; + virtual void CreateView() = 0; // Sets up the View that holds the rendered web page, receives messages for // it and contains page plugins. diff --git a/chrome/browser/web_contents_view_win.cc b/chrome/browser/web_contents_view_win.cc index dcf8136..7c369f7 100644 --- a/chrome/browser/web_contents_view_win.cc +++ b/chrome/browser/web_contents_view_win.cc @@ -52,10 +52,9 @@ WebContents* WebContentsViewWin::GetWebContents() { return web_contents_; } -void WebContentsViewWin::CreateView(HWND parent_hwnd, - const gfx::Rect& initial_bounds) { +void WebContentsViewWin::CreateView() { set_delete_on_destroy(false); - ContainerWin::Init(parent_hwnd, initial_bounds, false); + ContainerWin::Init(GetDesktopWindow(), gfx::Rect(), false); // Remove the root view drop target so we can register our own. RevokeDragDrop(GetHWND()); @@ -365,13 +364,7 @@ WebContents* WebContentsViewWin::CreateNewWindowInternal( new_contents->SetupController(web_contents_->profile()); WebContentsView* new_view = new_contents->view(); - // TODO(beng) - // The intention here is to create background tabs, which should ideally - // be parented to NULL. However doing that causes the corresponding view - // container windows to show up as overlapped windows, which causes - // other issues. We should fix this. - HWND new_view_parent_window = ::GetAncestor(GetContainerHWND(), GA_ROOT); - new_view->CreateView(new_view_parent_window, gfx::Rect()); + new_view->CreateView(); // TODO(brettw) it seems bogus that we have to call this function on the // newly created object and give it one of its own member variables. diff --git a/chrome/browser/web_contents_view_win.h b/chrome/browser/web_contents_view_win.h index ca03829..ee28e87 100644 --- a/chrome/browser/web_contents_view_win.h +++ b/chrome/browser/web_contents_view_win.h @@ -31,8 +31,7 @@ class WebContentsViewWin : public WebContentsView, // WebContentsView implementation -------------------------------------------- virtual WebContents* GetWebContents(); - virtual void CreateView(HWND parent_hwnd, - const gfx::Rect& initial_bounds); + virtual void CreateView(); virtual RenderWidgetHostViewWin* CreateViewForWidget( RenderWidgetHost* render_widget_host); virtual HWND GetContainerHWND() const; |