| 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_window_gtk.h" | 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "chrome/browser/ui/browser_list.h" | 8 #include "chrome/browser/ui/browser_list.h" |
| 9 #include "chrome/browser/ui/panels/panel.h" | 9 #include "chrome/browser/ui/panels/panel.h" |
| 10 #include "chrome/browser/ui/panels/panel_manager.h" | 10 #include "chrome/browser/ui/panels/panel_manager.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 270 |
| 271 void PanelBrowserWindowGtk::ClosePanel() { | 271 void PanelBrowserWindowGtk::ClosePanel() { |
| 272 // Cancel any currently running animation since we're closing down. | 272 // Cancel any currently running animation since we're closing down. |
| 273 if (bounds_animator_.get()) | 273 if (bounds_animator_.get()) |
| 274 bounds_animator_.reset(); | 274 bounds_animator_.reset(); |
| 275 | 275 |
| 276 Close(); | 276 Close(); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void PanelBrowserWindowGtk::ActivatePanel() { | 279 void PanelBrowserWindowGtk::ActivatePanel() { |
| 280 gdk_window_set_accept_focus(GTK_WIDGET(window())->window, TRUE); | 280 gdk_window_set_accept_focus( |
| 281 gtk_widget_get_window(GTK_WIDGET(window())), TRUE); |
| 281 Activate(); | 282 Activate(); |
| 282 } | 283 } |
| 283 | 284 |
| 284 void PanelBrowserWindowGtk::DeactivatePanel() { | 285 void PanelBrowserWindowGtk::DeactivatePanel() { |
| 285 BrowserWindow* browser_window = | 286 BrowserWindow* browser_window = |
| 286 panel_->manager()->GetNextBrowserWindowToActivate(panel_.get()); | 287 panel_->manager()->GetNextBrowserWindowToActivate(panel_.get()); |
| 287 if (browser_window) { | 288 if (browser_window) { |
| 288 browser_window->Activate(); | 289 browser_window->Activate(); |
| 289 } else { | 290 } else { |
| 290 Deactivate(); | 291 Deactivate(); |
| 291 } | 292 } |
| 292 | 293 |
| 293 if (panel_->expansion_state() == Panel::MINIMIZED) | 294 if (panel_->expansion_state() == Panel::MINIMIZED) { |
| 294 gdk_window_set_accept_focus(GTK_WIDGET(window())->window, FALSE); | 295 gdk_window_set_accept_focus( |
| 296 gtk_widget_get_window(GTK_WIDGET(window())), FALSE); |
| 297 } |
| 295 } | 298 } |
| 296 | 299 |
| 297 bool PanelBrowserWindowGtk::IsPanelActive() const { | 300 bool PanelBrowserWindowGtk::IsPanelActive() const { |
| 298 return IsActive(); | 301 return IsActive(); |
| 299 } | 302 } |
| 300 | 303 |
| 301 gfx::NativeWindow PanelBrowserWindowGtk::GetNativePanelHandle() { | 304 gfx::NativeWindow PanelBrowserWindowGtk::GetNativePanelHandle() { |
| 302 return GetNativeHandle(); | 305 return GetNativeHandle(); |
| 303 } | 306 } |
| 304 | 307 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 // Don't draw attention for active panel. | 345 // Don't draw attention for active panel. |
| 343 if (is_drawing_attention_ || IsActive()) | 346 if (is_drawing_attention_ || IsActive()) |
| 344 return; | 347 return; |
| 345 | 348 |
| 346 is_drawing_attention_ = true; | 349 is_drawing_attention_ = true; |
| 347 // Bring up the titlebar to get people's attention. | 350 // Bring up the titlebar to get people's attention. |
| 348 if (panel_->expansion_state() == Panel::MINIMIZED) | 351 if (panel_->expansion_state() == Panel::MINIMIZED) |
| 349 panel_->SetExpansionState(Panel::TITLE_ONLY); | 352 panel_->SetExpansionState(Panel::TITLE_ONLY); |
| 350 | 353 |
| 351 GdkRectangle rect = GetTitlebarRectForDrawAttention(); | 354 GdkRectangle rect = GetTitlebarRectForDrawAttention(); |
| 352 gdk_window_invalidate_rect(GTK_WIDGET(window())->window, &rect, TRUE); | 355 gdk_window_invalidate_rect( |
| 356 gtk_widget_get_window(GTK_WIDGET(window())), &rect, TRUE); |
| 353 | 357 |
| 354 UpdateTitleBar(); | 358 UpdateTitleBar(); |
| 355 } | 359 } |
| 356 | 360 |
| 357 bool PanelBrowserWindowGtk::IsDrawingAttention() const { | 361 bool PanelBrowserWindowGtk::IsDrawingAttention() const { |
| 358 return is_drawing_attention_; | 362 return is_drawing_attention_; |
| 359 } | 363 } |
| 360 | 364 |
| 361 bool PanelBrowserWindowGtk::PreHandlePanelKeyboardEvent( | 365 bool PanelBrowserWindowGtk::PreHandlePanelKeyboardEvent( |
| 362 const NativeWebKeyboardEvent& event, | 366 const NativeWebKeyboardEvent& event, |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 757 } |
| 754 } | 758 } |
| 755 | 759 |
| 756 bool NativePanelTestingGtk::IsWindowSizeKnown() const { | 760 bool NativePanelTestingGtk::IsWindowSizeKnown() const { |
| 757 return panel_browser_window_gtk_->window_size_known_; | 761 return panel_browser_window_gtk_->window_size_known_; |
| 758 } | 762 } |
| 759 | 763 |
| 760 bool NativePanelTestingGtk::IsAnimatingBounds() const { | 764 bool NativePanelTestingGtk::IsAnimatingBounds() const { |
| 761 return panel_browser_window_gtk_->IsAnimatingBounds(); | 765 return panel_browser_window_gtk_->IsAnimatingBounds(); |
| 762 } | 766 } |
| OLD | NEW |