OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 10 |
10 #include "app/menus/simple_menu_model.h" | 11 #include "app/menus/simple_menu_model.h" |
11 #include "app/theme_provider.h" | 12 #include "app/theme_provider.h" |
12 #include "chrome/app/chrome_dll_resource.h" | 13 #include "chrome/app/chrome_dll_resource.h" |
13 #include "chrome/browser/chromeos/compact_location_bar_host.h" | 14 #include "chrome/browser/chromeos/compact_location_bar_host.h" |
14 #include "chrome/browser/chromeos/compact_navigation_bar.h" | 15 #include "chrome/browser/chromeos/compact_navigation_bar.h" |
15 #include "chrome/browser/chromeos/frame/panel_browser_view.h" | 16 #include "chrome/browser/chromeos/frame/panel_browser_view.h" |
16 #include "chrome/browser/chromeos/options/language_config_view.h" | 17 #include "chrome/browser/chromeos/options/language_config_view.h" |
17 #include "chrome/browser/chromeos/status/browser_status_area_view.h" | 18 #include "chrome/browser/chromeos/status/browser_status_area_view.h" |
18 #include "chrome/browser/chromeos/status/language_menu_button.h" | 19 #include "chrome/browser/chromeos/status/language_menu_button.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 // The ContextMenuController has to be set to a NonClientView but | 386 // The ContextMenuController has to be set to a NonClientView but |
386 // not to a NonClientFrameView because a TabStrip is not a child of | 387 // not to a NonClientFrameView because a TabStrip is not a child of |
387 // a NonClientFrameView even though visually a TabStrip is over a | 388 // a NonClientFrameView even though visually a TabStrip is over a |
388 // NonClientFrameView. | 389 // NonClientFrameView. |
389 BrowserFrameGtk* gtk_frame = static_cast<BrowserFrameGtk*>(frame()); | 390 BrowserFrameGtk* gtk_frame = static_cast<BrowserFrameGtk*>(frame()); |
390 gtk_frame->GetNonClientView()->SetContextMenuController(this); | 391 gtk_frame->GetNonClientView()->SetContextMenuController(this); |
391 | 392 |
392 otr_avatar_icon_->SetImage(GetOTRAvatarIcon()); | 393 otr_avatar_icon_->SetImage(GetOTRAvatarIcon()); |
393 otr_avatar_icon_->SetID(VIEW_ID_OTR_AVATAR); | 394 otr_avatar_icon_->SetID(VIEW_ID_OTR_AVATAR); |
394 AddChildView(otr_avatar_icon_); | 395 AddChildView(otr_avatar_icon_); |
| 396 |
| 397 // Make sure the window is set to the right type. |
| 398 std::vector<int> params; |
| 399 params.push_back(browser()->tab_count()); |
| 400 params.push_back(browser()->selected_index()); |
| 401 WmIpc::instance()->SetWindowType( |
| 402 GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()), |
| 403 WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL, |
| 404 ¶ms); |
395 } | 405 } |
396 | 406 |
397 void BrowserView::Show() { | 407 void BrowserView::Show() { |
398 bool was_visible = frame()->GetWindow()->IsVisible(); | 408 bool was_visible = frame()->GetWindow()->IsVisible(); |
399 ::BrowserView::Show(); | 409 ::BrowserView::Show(); |
400 if (!was_visible) { | 410 if (!was_visible) { |
| 411 // Have to update the tab count and selected index to reflect reality. |
| 412 std::vector<int> params; |
| 413 params.push_back(browser()->tab_count()); |
| 414 params.push_back(browser()->selected_index()); |
401 WmIpc::instance()->SetWindowType( | 415 WmIpc::instance()->SetWindowType( |
402 GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()), | 416 GTK_WIDGET(frame()->GetWindow()->GetNativeWindow()), |
403 WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL, | 417 WmIpc::WINDOW_TYPE_CHROME_TOPLEVEL, |
404 NULL); | 418 ¶ms); |
405 } | 419 } |
406 } | 420 } |
407 | 421 |
408 bool BrowserView::IsToolbarVisible() const { | 422 bool BrowserView::IsToolbarVisible() const { |
409 if (is_compact_style()) | 423 if (is_compact_style()) |
410 return false; | 424 return false; |
411 return ::BrowserView::IsToolbarVisible(); | 425 return ::BrowserView::IsToolbarVisible(); |
412 } | 426 } |
413 | 427 |
414 void BrowserView::SetFocusToLocationBar(bool select_all) { | 428 void BrowserView::SetFocusToLocationBar(bool select_all) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 542 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
529 // Create a browser view for chromeos. | 543 // Create a browser view for chromeos. |
530 BrowserView* view; | 544 BrowserView* view; |
531 if (browser->type() & Browser::TYPE_POPUP) | 545 if (browser->type() & Browser::TYPE_POPUP) |
532 view = new chromeos::PanelBrowserView(browser); | 546 view = new chromeos::PanelBrowserView(browser); |
533 else | 547 else |
534 view = new chromeos::BrowserView(browser); | 548 view = new chromeos::BrowserView(browser); |
535 BrowserFrame::Create(view, browser->profile()); | 549 BrowserFrame::Create(view, browser->profile()); |
536 return view; | 550 return view; |
537 } | 551 } |
OLD | NEW |