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

Side by Side Diff: chrome/browser/ui/browser_tab_strip_model_delegate.cc

Issue 10692195: Consolidate Browser Creation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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/browser_tab_strip_model_delegate.h" 5 #include "chrome/browser/ui/browser_tab_strip_model_delegate.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sessions/tab_restore_service.h" 10 #include "chrome/browser/sessions/tab_restore_service.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const gfx::Rect& window_bounds, 54 const gfx::Rect& window_bounds,
55 const DockInfo& dock_info, 55 const DockInfo& dock_info,
56 bool maximize) { 56 bool maximize) {
57 DCHECK(browser_->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)); 57 DCHECK(browser_->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP));
58 58
59 gfx::Rect new_window_bounds = window_bounds; 59 gfx::Rect new_window_bounds = window_bounds;
60 if (dock_info.GetNewWindowBounds(&new_window_bounds, &maximize)) 60 if (dock_info.GetNewWindowBounds(&new_window_bounds, &maximize))
61 dock_info.AdjustOtherWindowBounds(); 61 dock_info.AdjustOtherWindowBounds();
62 62
63 // Create an empty new browser window the same size as the old one. 63 // Create an empty new browser window the same size as the old one.
64 Browser* browser = new Browser(Browser::TYPE_TABBED, browser_->profile()); 64 Browser::CreateParams params(browser_->profile());
65 browser->set_override_bounds(new_window_bounds); 65 params.initial_bounds = new_window_bounds;
66 browser->set_initial_show_state( 66 params.initial_show_state =
67 maximize ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL); 67 maximize ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL;
68 browser->InitBrowserWindow(); 68 Browser* browser = new Browser(params);
69 browser->tab_strip_model()->AppendTabContents(detached_contents, true); 69 browser->tab_strip_model()->AppendTabContents(detached_contents, true);
70 // Make sure the loading state is updated correctly, otherwise the throbber 70 // Make sure the loading state is updated correctly, otherwise the throbber
71 // won't start if the page is loading. 71 // won't start if the page is loading.
72 // TODO(beng): find a better way of doing this. 72 // TODO(beng): find a better way of doing this.
73 static_cast<content::WebContentsDelegate*>(browser)-> 73 static_cast<content::WebContentsDelegate*>(browser)->
74 LoadingStateChanged(detached_contents->web_contents()); 74 LoadingStateChanged(detached_contents->web_contents());
75 return browser; 75 return browser;
76 } 76 }
77 77
78 int BrowserTabStripModelDelegate::GetDragActions() const { 78 int BrowserTabStripModelDelegate::GetDragActions() const {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 } 158 }
159 159
160 //////////////////////////////////////////////////////////////////////////////// 160 ////////////////////////////////////////////////////////////////////////////////
161 // BrowserTabStripModelDelegate, private: 161 // BrowserTabStripModelDelegate, private:
162 162
163 void BrowserTabStripModelDelegate::CloseFrame() { 163 void BrowserTabStripModelDelegate::CloseFrame() {
164 browser_->window()->Close(); 164 browser_->window()->Close();
165 } 165 }
166 166
167 } // namespace chrome 167 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698