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

Side by Side Diff: chrome/browser/chromeos/frame/browser_view.cc

Issue 6692001: Add in DOMBrowserView and Frame related classes (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed DOMBrowserFrame* classes and added changes in line with oshima's comments Created 9 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/webui/login/browser/dom_browser.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/chromeos/frame/browser_view.h" 5 #include "chrome/browser/chromeos/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 // The tabstrip's width is the bigger of it's preferred width and the width 159 // The tabstrip's width is the bigger of it's preferred width and the width
160 // the status area. 160 // the status area.
161 int tabstrip_w = std::max(status_x + status_size.width(), 161 int tabstrip_w = std::max(status_x + status_size.width(),
162 tabstrip_->GetPreferredSize().width()); 162 tabstrip_->GetPreferredSize().width());
163 tabstrip_->SetBounds(bounds.x(), bounds.y(), tabstrip_w, 163 tabstrip_->SetBounds(bounds.x(), bounds.y(), tabstrip_w,
164 bounds.height() - status_height); 164 bounds.height() - status_height);
165 165
166 // The toolbar is promoted to the title for vertical tabs. 166 // The toolbar is promoted to the title for vertical tabs.
167 bool toolbar_visible = browser_view_->IsToolbarVisible(); 167 bool toolbar_visible = browser_view_->IsToolbarVisible();
168 toolbar_->SetVisible(toolbar_visible);
169 int toolbar_height = 0; 168 int toolbar_height = 0;
170 if (toolbar_visible) 169 if (toolbar_) {
171 toolbar_height = toolbar_->GetPreferredSize().height(); 170 toolbar_->SetVisible(toolbar_visible);
172 int tabstrip_max_x = tabstrip_->bounds().right(); 171 if (toolbar_visible)
173 toolbar_->SetBounds(tabstrip_max_x, 172 toolbar_height = toolbar_->GetPreferredSize().height();
174 bounds.y() - kVerticalTabStripToolbarOffset, 173 int tabstrip_max_x = tabstrip_->bounds().right();
175 browser_view_->width() - tabstrip_max_x, 174 toolbar_->SetBounds(tabstrip_max_x,
176 toolbar_height); 175 bounds.y() - kVerticalTabStripToolbarOffset,
177 176 browser_view_->width() - tabstrip_max_x,
177 toolbar_height);
178 }
178 // Adjust the available bounds for other components. 179 // Adjust the available bounds for other components.
179 gfx::Rect available_bounds = vertical_layout_rect(); 180 gfx::Rect available_bounds = vertical_layout_rect();
180 available_bounds.Inset(tabstrip_w, 0, 0, 0); 181 available_bounds.Inset(tabstrip_w, 0, 0, 0);
181 set_vertical_layout_rect(available_bounds); 182 set_vertical_layout_rect(available_bounds);
182
183 return bounds.y() + toolbar_height; 183 return bounds.y() + toolbar_height;
184 } 184 }
185 185
186 // Lays out tabstrip and status area in the title bar area (given by 186 // Lays out tabstrip and status area in the title bar area (given by
187 // |bounds|). 187 // |bounds|).
188 int LayoutTitlebarComponents(const gfx::Rect& bounds) { 188 int LayoutTitlebarComponents(const gfx::Rect& bounds) {
189 if (bounds.IsEmpty()) 189 if (bounds.IsEmpty())
190 return 0; 190 return 0;
191 191
192 tabstrip_->SetVisible(true); 192 tabstrip_->SetVisible(true);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 InitSystemMenu(); 230 InitSystemMenu();
231 231
232 // The ContextMenuController has to be set to a NonClientView but 232 // The ContextMenuController has to be set to a NonClientView but
233 // not to a NonClientFrameView because a TabStrip is not a child of 233 // not to a NonClientFrameView because a TabStrip is not a child of
234 // a NonClientFrameView even though visually a TabStrip is over a 234 // a NonClientFrameView even though visually a TabStrip is over a
235 // NonClientFrameView. 235 // NonClientFrameView.
236 BrowserFrameGtk* gtk_frame = static_cast<BrowserFrameGtk*>(frame()); 236 BrowserFrameGtk* gtk_frame = static_cast<BrowserFrameGtk*>(frame());
237 gtk_frame->non_client_view()->SetContextMenuController(this); 237 gtk_frame->non_client_view()->SetContextMenuController(this);
238 238
239 // Listen to wrench menu opens. 239 // Listen to wrench menu opens.
240 toolbar()->AddMenuListener(this); 240 if (toolbar())
241 toolbar()->AddMenuListener(this);
241 242
242 // Make sure the window is set to the right type. 243 // Make sure the window is set to the right type.
243 std::vector<int> params; 244 std::vector<int> params;
244 params.push_back(browser()->tab_count()); 245 params.push_back(browser()->tab_count());
245 params.push_back(browser()->selected_index()); 246 params.push_back(browser()->selected_index());
246 params.push_back(gtk_get_current_event_time()); 247 params.push_back(gtk_get_current_event_time());
247 WmIpc::instance()->SetWindowType( 248 WmIpc::instance()->SetWindowType(
248 GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()), 249 GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()),
249 WM_IPC_WINDOW_CHROME_TOPLEVEL, 250 WM_IPC_WINDOW_CHROME_TOPLEVEL,
250 &params); 251 &params);
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 385 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
385 // Create a browser view for chromeos. 386 // Create a browser view for chromeos.
386 BrowserView* view; 387 BrowserView* view;
387 if (browser->type() & Browser::TYPE_POPUP) 388 if (browser->type() & Browser::TYPE_POPUP)
388 view = new chromeos::PanelBrowserView(browser); 389 view = new chromeos::PanelBrowserView(browser);
389 else 390 else
390 view = new chromeos::BrowserView(browser); 391 view = new chromeos::BrowserView(browser);
391 BrowserFrame::Create(view, browser->profile()); 392 BrowserFrame::Create(view, browser->profile());
392 return view; 393 return view;
393 } 394 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/webui/login/browser/dom_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698