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

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

Issue 7015051: Re-land: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 7 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) 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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // BrowserView, ::BrowserView overrides: 233 // BrowserView, ::BrowserView overrides:
234 234
235 void BrowserView::Init() { 235 void BrowserView::Init() {
236 ::BrowserView::Init(); 236 ::BrowserView::Init();
237 status_area_ = new StatusAreaView(this); 237 status_area_ = new StatusAreaView(this);
238 status_area_->SetID(VIEW_ID_STATUS_AREA); 238 status_area_->SetID(VIEW_ID_STATUS_AREA);
239 AddChildView(status_area_); 239 AddChildView(status_area_);
240 status_area_->Init(); 240 status_area_->Init();
241 InitSystemMenu(); 241 InitSystemMenu();
242 242
243 // The ContextMenuController has to be set to a NonClientView but 243 frame()->non_client_view()->SetContextMenuController(this);
244 // not to a NonClientFrameView because a TabStrip is not a child of
245 // a NonClientFrameView even though visually a TabStrip is over a
246 // NonClientFrameView.
247 BrowserFrameGtk* gtk_frame = static_cast<BrowserFrameGtk*>(frame());
248 gtk_frame->non_client_view()->SetContextMenuController(this);
249 244
250 // Listen to wrench menu opens. 245 // Listen to wrench menu opens.
251 if (toolbar()) 246 if (toolbar())
252 toolbar()->AddMenuListener(this); 247 toolbar()->AddMenuListener(this);
253 248
254 // Make sure the window is set to the right type. 249 // Make sure the window is set to the right type.
255 std::vector<int> params; 250 std::vector<int> params;
256 params.push_back(browser()->tab_count()); 251 params.push_back(browser()->tab_count());
257 params.push_back(browser()->active_index()); 252 params.push_back(browser()->active_index());
258 params.push_back(gtk_get_current_event_time()); 253 params.push_back(gtk_get_current_event_time());
259 WmIpc::instance()->SetWindowType( 254 WmIpc::instance()->SetWindowType(
260 GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()), 255 GTK_WIDGET(frame()->GetNativeWindow()),
261 WM_IPC_WINDOW_CHROME_TOPLEVEL, 256 WM_IPC_WINDOW_CHROME_TOPLEVEL,
262 &params); 257 &params);
263 } 258 }
264 259
265 void BrowserView::Show() { 260 void BrowserView::Show() {
266 ShowInternal(true); 261 ShowInternal(true);
267 } 262 }
268 263
269 void BrowserView::ShowInactive() { 264 void BrowserView::ShowInactive() {
270 ShowInternal(false); 265 ShowInternal(false);
271 } 266 }
272 267
273 void BrowserView::ShowInternal(bool is_active) { 268 void BrowserView::ShowInternal(bool is_active) {
274 bool was_visible = frame()->GetWindow()->IsVisible(); 269 bool was_visible = frame()->IsVisible();
275 if (is_active) 270 if (is_active)
276 ::BrowserView::Show(); 271 ::BrowserView::Show();
277 else 272 else
278 ::BrowserView::ShowInactive(); 273 ::BrowserView::ShowInactive();
279 if (!was_visible) { 274 if (!was_visible) {
280 // Have to update the tab count and selected index to reflect reality. 275 // Have to update the tab count and selected index to reflect reality.
281 std::vector<int> params; 276 std::vector<int> params;
282 params.push_back(browser()->tab_count()); 277 params.push_back(browser()->tab_count());
283 params.push_back(browser()->active_index()); 278 params.push_back(browser()->active_index());
284 WmIpc::instance()->SetWindowType( 279 WmIpc::instance()->SetWindowType(
285 GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()), 280 GTK_WIDGET(frame()->GetNativeWindow()),
286 WM_IPC_WINDOW_CHROME_TOPLEVEL, 281 WM_IPC_WINDOW_CHROME_TOPLEVEL,
287 &params); 282 &params);
288 } 283 }
289 } 284 }
290 285
291 void BrowserView::FocusChromeOSStatus() { 286 void BrowserView::FocusChromeOSStatus() {
292 SaveFocusedView(); 287 SaveFocusedView();
293 status_area_->SetPaneFocus(last_focused_view_storage_id(), NULL); 288 status_area_->SetPaneFocus(last_focused_view_storage_id(), NULL);
294 } 289 }
295 290
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 } // namespace chromeos 423 } // namespace chromeos
429 424
430 // static 425 // static
431 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 426 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
432 // Create a browser view for chromeos. 427 // Create a browser view for chromeos.
433 BrowserView* view; 428 BrowserView* view;
434 if (browser->is_type_popup() || browser->is_type_panel()) 429 if (browser->is_type_popup() || browser->is_type_panel())
435 view = new chromeos::PanelBrowserView(browser); 430 view = new chromeos::PanelBrowserView(browser);
436 else 431 else
437 view = new chromeos::BrowserView(browser); 432 view = new chromeos::BrowserView(browser);
438 BrowserFrame::Create(view, browser->profile()); 433 (new BrowserFrame(view))->InitBrowserFrame();
439 return view; 434 return view;
440 } 435 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/frame/browser_frame_view_chromeos.cc ('k') | chrome/browser/chromeos/frame/bubble_frame_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698