| OLD | NEW |
| 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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "ui/base/theme_provider.h" | 38 #include "ui/base/theme_provider.h" |
| 39 #include "ui/gfx/canvas.h" | 39 #include "ui/gfx/canvas.h" |
| 40 #include "ui/gfx/screen.h" | 40 #include "ui/gfx/screen.h" |
| 41 #include "views/controls/button/button.h" | 41 #include "views/controls/button/button.h" |
| 42 #include "views/controls/button/image_button.h" | 42 #include "views/controls/button/image_button.h" |
| 43 #include "views/controls/menu/menu_delegate.h" | 43 #include "views/controls/menu/menu_delegate.h" |
| 44 #include "views/controls/menu/menu_item_view.h" | 44 #include "views/controls/menu/menu_item_view.h" |
| 45 #include "views/controls/menu/menu_runner.h" | 45 #include "views/controls/menu/menu_runner.h" |
| 46 #include "views/widget/root_view.h" | 46 #include "views/widget/root_view.h" |
| 47 #include "views/widget/widget.h" | 47 #include "views/widget/widget.h" |
| 48 #include "views/widget/wm_ipc.h" |
| 48 | 49 |
| 49 #if defined(TOOLKIT_USES_GTK) | 50 #if defined(TOOLKIT_USES_GTK) |
| 50 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" | 51 #include "chrome/browser/chromeos/legacy_window_manager/wm_ipc.h" |
| 51 #endif | 52 #endif |
| 52 | 53 |
| 53 namespace { | 54 namespace { |
| 54 | 55 |
| 55 // Amount to tweak the position of the status area to get it to look right. | 56 // Amount to tweak the position of the status area to get it to look right. |
| 56 const int kStatusAreaVerticalAdjustment = -1; | 57 const int kStatusAreaVerticalAdjustment = -1; |
| 57 | 58 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 has_hide_status_area_property_(false), | 311 has_hide_status_area_property_(false), |
| 311 should_show_layout_mode_button_(false) { | 312 should_show_layout_mode_button_(false) { |
| 312 system_menu_delegate_.reset(new SimpleMenuModelDelegateAdapter(this)); | 313 system_menu_delegate_.reset(new SimpleMenuModelDelegateAdapter(this)); |
| 313 BrowserList::AddObserver(this); | 314 BrowserList::AddObserver(this); |
| 314 MessageLoopForUI::current()->AddObserver(this); | 315 MessageLoopForUI::current()->AddObserver(this); |
| 315 | 316 |
| 316 #if defined(TOOLKIT_USES_GTK) | 317 #if defined(TOOLKIT_USES_GTK) |
| 317 if (!g_chrome_state_gdk_atom) | 318 if (!g_chrome_state_gdk_atom) |
| 318 g_chrome_state_gdk_atom = | 319 g_chrome_state_gdk_atom = |
| 319 gdk_atom_intern( | 320 gdk_atom_intern( |
| 320 WmIpc::instance()->GetAtomName(WmIpc::ATOM_CHROME_STATE).c_str(), | 321 WmIpc::instance()->GetAtomName( |
| 322 views::chromeos::WmIpc::ATOM_CHROME_STATE).c_str(), |
| 321 FALSE); // !only_if_exists | 323 FALSE); // !only_if_exists |
| 322 #endif | 324 #endif |
| 323 } | 325 } |
| 324 | 326 |
| 325 BrowserView::~BrowserView() { | 327 BrowserView::~BrowserView() { |
| 326 if (toolbar()) | 328 if (toolbar()) |
| 327 toolbar()->RemoveMenuListener(this); | 329 toolbar()->RemoveMenuListener(this); |
| 328 MessageLoopForUI::current()->RemoveObserver(this); | 330 MessageLoopForUI::current()->RemoveObserver(this); |
| 329 BrowserList::RemoveObserver(this); | 331 BrowserList::RemoveObserver(this); |
| 330 } | 332 } |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 menu->AppendSeparator(); | 625 menu->AppendSeparator(); |
| 624 menu->AppendMenuItemWithLabel(IDC_TASK_MANAGER, | 626 menu->AppendMenuItemWithLabel(IDC_TASK_MANAGER, |
| 625 l10n_util::GetStringUTF16(IDS_TASK_MANAGER)); | 627 l10n_util::GetStringUTF16(IDS_TASK_MANAGER)); |
| 626 } | 628 } |
| 627 | 629 |
| 628 void BrowserView::FetchHideStatusAreaProperty() { | 630 void BrowserView::FetchHideStatusAreaProperty() { |
| 629 #if defined(TOOLKIT_USES_GTK) | 631 #if defined(TOOLKIT_USES_GTK) |
| 630 std::set<WmIpc::AtomType> state_atoms; | 632 std::set<WmIpc::AtomType> state_atoms; |
| 631 if (WmIpc::instance()->GetWindowState( | 633 if (WmIpc::instance()->GetWindowState( |
| 632 GTK_WIDGET(frame()->GetNativeWindow()), &state_atoms)) { | 634 GTK_WIDGET(frame()->GetNativeWindow()), &state_atoms)) { |
| 633 if (state_atoms.count(WmIpc::ATOM_CHROME_STATE_STATUS_HIDDEN)) { | 635 if (state_atoms.count( |
| 636 views::chromeos::WmIpc::ATOM_CHROME_STATE_STATUS_HIDDEN)) { |
| 634 has_hide_status_area_property_ = true; | 637 has_hide_status_area_property_ = true; |
| 635 return; | 638 return; |
| 636 } | 639 } |
| 637 } | 640 } |
| 638 #endif | 641 #endif |
| 639 has_hide_status_area_property_ = false; | 642 has_hide_status_area_property_ = false; |
| 640 } | 643 } |
| 641 | 644 |
| 642 void BrowserView::UpdateLayoutModeButtonVisibility() { | 645 void BrowserView::UpdateLayoutModeButtonVisibility() { |
| 643 int count = 0; | 646 int count = 0; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 660 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 663 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 661 // Create a browser view for chromeos. | 664 // Create a browser view for chromeos. |
| 662 BrowserView* view; | 665 BrowserView* view; |
| 663 if (browser->is_type_popup() || browser->is_type_panel()) | 666 if (browser->is_type_popup() || browser->is_type_panel()) |
| 664 view = new chromeos::PanelBrowserView(browser); | 667 view = new chromeos::PanelBrowserView(browser); |
| 665 else | 668 else |
| 666 view = new chromeos::BrowserView(browser); | 669 view = new chromeos::BrowserView(browser); |
| 667 (new BrowserFrame(view))->InitBrowserFrame(); | 670 (new BrowserFrame(view))->InitBrowserFrame(); |
| 668 return view; | 671 return view; |
| 669 } | 672 } |
| OLD | NEW |