| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/views/panel_controller.h" | 5 #include "chrome/browser/views/panel_controller.h" |
| 6 | 6 |
| 7 #include <gdk/gdkx.h> | 7 #include <gdk/gdkx.h> |
| 8 extern "C" { | 8 extern "C" { |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 } | 10 } |
| 11 | 11 |
| 12 #include "app/resource_bundle.h" | 12 #include "app/resource_bundle.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/singleton.h" | 14 #include "base/singleton.h" |
| 15 #include "base/scoped_ptr.h" | 15 #include "base/scoped_ptr.h" |
| 16 #include "base/string_util.h" |
| 16 #include "chrome/browser/browser.h" | 17 #include "chrome/browser/browser.h" |
| 17 #include "chrome/browser/gtk/browser_window_gtk.h" | 18 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 18 #include "chrome/browser/views/tabs/tab_overview_types.h" | 19 #include "chrome/browser/views/tabs/tab_overview_types.h" |
| 19 #include "chrome/common/x11_util.h" | 20 #include "chrome/common/x11_util.h" |
| 20 #include "grit/app_resources.h" | 21 #include "grit/app_resources.h" |
| 21 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
| 22 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
| 23 #include "views/controls/button/image_button.h" | 24 #include "views/controls/button/image_button.h" |
| 24 #include "views/controls/label.h" | 25 #include "views/controls/label.h" |
| 25 #include "views/event.h" | 26 #include "views/event.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 g_signal_connect( | 89 g_signal_connect( |
| 89 panel_, "client-event", G_CALLBACK(OnPanelClientEvent), this); | 90 panel_, "client-event", G_CALLBACK(OnPanelClientEvent), this); |
| 90 | 91 |
| 91 title_content_ = new TitleContentView(this); | 92 title_content_ = new TitleContentView(this); |
| 92 title_window_->SetContentsView(title_content_); | 93 title_window_->SetContentsView(title_content_); |
| 93 title_window_->Show(); | 94 title_window_->Show(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 void PanelController::UpdateTitleBar() { | 97 void PanelController::UpdateTitleBar() { |
| 97 title_content_->title_label()->SetText( | 98 title_content_->title_label()->SetText( |
| 98 browser_window_->browser()->GetCurrentPageTitle()); | 99 UTF16ToWideHack(browser_window_->browser()->GetCurrentPageTitle())); |
| 99 } | 100 } |
| 100 | 101 |
| 101 bool PanelController::TitleMousePressed(const views::MouseEvent& event) { | 102 bool PanelController::TitleMousePressed(const views::MouseEvent& event) { |
| 102 if (!event.IsOnlyLeftMouseButton()) { | 103 if (!event.IsOnlyLeftMouseButton()) { |
| 103 return false; | 104 return false; |
| 104 } | 105 } |
| 105 gfx::Point abs_location = event.location(); | 106 gfx::Point abs_location = event.location(); |
| 106 views::View::ConvertPointToScreen(title_content_, &abs_location); | 107 views::View::ConvertPointToScreen(title_content_, &abs_location); |
| 107 mouse_down_ = true; | 108 mouse_down_ = true; |
| 108 mouse_down_abs_x_ = abs_location.x(); | 109 mouse_down_abs_x_ = abs_location.x(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 void PanelController::TitleContentView::OnMouseReleased( | 229 void PanelController::TitleContentView::OnMouseReleased( |
| 229 const views::MouseEvent& event, bool canceled) { | 230 const views::MouseEvent& event, bool canceled) { |
| 230 return panel_controller_->TitleMouseReleased(event, canceled); | 231 return panel_controller_->TitleMouseReleased(event, canceled); |
| 231 } | 232 } |
| 232 | 233 |
| 233 bool PanelController::TitleContentView::OnMouseDragged( | 234 bool PanelController::TitleContentView::OnMouseDragged( |
| 234 const views::MouseEvent& event) { | 235 const views::MouseEvent& event) { |
| 235 return panel_controller_->TitleMouseDragged(event); | 236 return panel_controller_->TitleMouseDragged(event); |
| 236 } | 237 } |
| 237 | 238 |
| OLD | NEW |