| 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/ui/panels/panel_browser_frame_view.h" | 5 #include "chrome/browser/ui/panels/panel_browser_frame_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/themes/theme_service.h" | 10 #include "chrome/browser/themes/theme_service.h" |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 l10n_util::GetStringUTF16(IDS_TOOLTIP_CLOSE_TAB)); | 266 l10n_util::GetStringUTF16(IDS_TOOLTIP_CLOSE_TAB)); |
| 267 close_button_->SetAccessibleName( | 267 close_button_->SetAccessibleName( |
| 268 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); | 268 l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)); |
| 269 AddChildView(close_button_); | 269 AddChildView(close_button_); |
| 270 | 270 |
| 271 title_icon_ = new TabIconView(this); | 271 title_icon_ = new TabIconView(this); |
| 272 title_icon_->set_is_light(true); | 272 title_icon_->set_is_light(true); |
| 273 AddChildView(title_icon_); | 273 AddChildView(title_icon_); |
| 274 title_icon_->Update(); | 274 title_icon_->Update(); |
| 275 | 275 |
| 276 title_label_ = new views::Label(string16()); | 276 title_label_ = new views::Label(GetTitleText()); |
| 277 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); | 277 title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); |
| 278 title_label_->SetAutoColorReadabilityEnabled(false); | 278 title_label_->SetAutoColorReadabilityEnabled(false); |
| 279 AddChildView(title_label_); | 279 AddChildView(title_label_); |
| 280 | 280 |
| 281 mouse_watcher_.reset(new MouseWatcher(this)); | 281 mouse_watcher_.reset(new MouseWatcher(this)); |
| 282 } | 282 } |
| 283 | 283 |
| 284 PanelBrowserFrameView::~PanelBrowserFrameView() { | 284 PanelBrowserFrameView::~PanelBrowserFrameView() { |
| 285 } | 285 } |
| 286 | 286 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 client_view_bounds_.x() - client_edges.bottom_left->width(), | 706 client_view_bounds_.x() - client_edges.bottom_left->width(), |
| 707 client_area_bottom); | 707 client_area_bottom); |
| 708 | 708 |
| 709 // Draw the left edge. | 709 // Draw the left edge. |
| 710 canvas->TileImageInt( | 710 canvas->TileImageInt( |
| 711 *(client_edges.left), | 711 *(client_edges.left), |
| 712 client_view_bounds_.x() - client_edges.left->width(), | 712 client_view_bounds_.x() - client_edges.left->width(), |
| 713 client_area_top, client_edges.left->width(), client_area_height); | 713 client_area_top, client_edges.left->width(), client_area_height); |
| 714 } | 714 } |
| 715 | 715 |
| 716 string16 PanelBrowserFrameView::GetTitleText() const { |
| 717 return frame()->widget_delegate()->GetWindowTitle(); |
| 718 } |
| 719 |
| 716 void PanelBrowserFrameView::UpdateTitleBar() { | 720 void PanelBrowserFrameView::UpdateTitleBar() { |
| 717 title_label_->SetText(frame()->widget_delegate()->GetWindowTitle()); | 721 title_label_->SetText(GetTitleText()); |
| 718 } | 722 } |
| 719 | 723 |
| 720 void PanelBrowserFrameView::OnFocusChanged(bool focused) { | 724 void PanelBrowserFrameView::OnFocusChanged(bool focused) { |
| 721 UpdateSettingsButtonVisibility(focused, | 725 UpdateSettingsButtonVisibility(focused, |
| 722 mouse_watcher_->IsCursorInViewBounds()); | 726 mouse_watcher_->IsCursorInViewBounds()); |
| 723 SchedulePaint(); | 727 SchedulePaint(); |
| 724 } | 728 } |
| 725 | 729 |
| 726 void PanelBrowserFrameView::OnMouseEnterOrLeaveWindow(bool mouse_entered) { | 730 void PanelBrowserFrameView::OnMouseEnterOrLeaveWindow(bool mouse_entered) { |
| 727 // Panel might be closed when we still watch the mouse event. | 731 // Panel might be closed when we still watch the mouse event. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 | 769 |
| 766 settings_menu_model_.reset( | 770 settings_menu_model_.reset( |
| 767 new PanelSettingsMenuModel(panel_browser_view_->panel())); | 771 new PanelSettingsMenuModel(panel_browser_view_->panel())); |
| 768 settings_menu_adapter_.reset( | 772 settings_menu_adapter_.reset( |
| 769 new views::MenuModelAdapter(settings_menu_model_.get())); | 773 new views::MenuModelAdapter(settings_menu_model_.get())); |
| 770 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); | 774 settings_menu_ = new views::MenuItemView(settings_menu_adapter_.get()); |
| 771 settings_menu_adapter_->BuildMenu(settings_menu_); | 775 settings_menu_adapter_->BuildMenu(settings_menu_); |
| 772 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); | 776 settings_menu_runner_.reset(new views::MenuRunner(settings_menu_)); |
| 773 return true; | 777 return true; |
| 774 } | 778 } |
| OLD | NEW |