Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/ui/panels/panel_browser_window_gtk.cc

Issue 9463022: Minimized panels should not open on Windows when activated by the OS (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: removed unnecessary include Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gtk/browser_titlebar.h" 9 #include "chrome/browser/ui/gtk/browser_titlebar.h"
10 #include "chrome/browser/ui/panels/panel.h" 10 #include "chrome/browser/ui/panels/panel.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this); 90 G_CALLBACK(OnTitlebarButtonReleaseEventThunk), this);
91 91
92 g_signal_connect(window_, "enter-notify-event", 92 g_signal_connect(window_, "enter-notify-event",
93 G_CALLBACK(OnEnterNotifyThunk), this); 93 G_CALLBACK(OnEnterNotifyThunk), this);
94 g_signal_connect(window_, "leave-notify-event", 94 g_signal_connect(window_, "leave-notify-event",
95 G_CALLBACK(OnLeaveNotifyThunk), this); 95 G_CALLBACK(OnLeaveNotifyThunk), this);
96 96
97 ui::WorkAreaWatcherX::AddObserver(this); 97 ui::WorkAreaWatcherX::AddObserver(this);
98 registrar_.Add( 98 registrar_.Add(
99 this, 99 this,
100 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
101 content::Source<Panel>(panel_.get()));
102 registrar_.Add(
103 this,
104 chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE, 100 chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE,
105 content::Source<Panel>(panel_.get())); 101 content::Source<Panel>(panel_.get()));
106 registrar_.Add( 102 registrar_.Add(
107 this, 103 this,
108 chrome::NOTIFICATION_WINDOW_CLOSED, 104 chrome::NOTIFICATION_WINDOW_CLOSED,
109 content::Source<GtkWindow>(window())); 105 content::Source<GtkWindow>(window()));
110 } 106 }
111 107
112 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) { 108 bool PanelBrowserWindowGtk::GetWindowEdge(int x, int y, GdkWindowEdge* edge) {
113 // Since panels are not resizable or movable by the user, we should not 109 // Since panels are not resizable or movable by the user, we should not
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 panel_->manager()->OnDisplayChanged(); 264 panel_->manager()->OnDisplayChanged();
269 } 265 }
270 266
271 void PanelBrowserWindowGtk::Observe( 267 void PanelBrowserWindowGtk::Observe(
272 int type, 268 int type,
273 const content::NotificationSource& source, 269 const content::NotificationSource& source,
274 const content::NotificationDetails& details) { 270 const content::NotificationDetails& details) {
275 switch (type) { 271 switch (type) {
276 case chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE: 272 case chrome::NOTIFICATION_PANEL_CHANGED_LAYOUT_MODE:
277 titlebar()->UpdateCustomFrame(true); 273 titlebar()->UpdateCustomFrame(true);
278 // No break. Accept focus code should execute for both cases.
279 case chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE:
280 gtk_window_set_accept_focus(window(), !panel_->IsMinimized());
281 break; 274 break;
282 case chrome::NOTIFICATION_WINDOW_CLOSED: 275 case chrome::NOTIFICATION_WINDOW_CLOSED:
283 // Cleanup. 276 // Cleanup.
284 if (bounds_animator_.get()) 277 if (bounds_animator_.get())
285 bounds_animator_.reset(); 278 bounds_animator_.reset();
286 279
287 CleanupDragDrop(); 280 CleanupDragDrop();
288 if (drag_widget_) { 281 if (drag_widget_) {
289 // Terminate the grab if we have it. We could do this using any widget, 282 // Terminate the grab if we have it. We could do this using any widget,
290 // |drag_widget_| is just convenient. 283 // |drag_widget_| is just convenient.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 browser_window->Activate(); 373 browser_window->Activate();
381 } else { 374 } else {
382 Deactivate(); 375 Deactivate();
383 } 376 }
384 } 377 }
385 378
386 bool PanelBrowserWindowGtk::IsPanelActive() const { 379 bool PanelBrowserWindowGtk::IsPanelActive() const {
387 return IsActive(); 380 return IsActive();
388 } 381 }
389 382
383 void PanelBrowserWindowGtk::PreventActivationByOS(bool prevent_activation) {
384 gtk_window_set_accept_focus(window(), !prevent_activation);
385 return;
386 }
387
390 gfx::NativeWindow PanelBrowserWindowGtk::GetNativePanelHandle() { 388 gfx::NativeWindow PanelBrowserWindowGtk::GetNativePanelHandle() {
391 return GetNativeHandle(); 389 return GetNativeHandle();
392 } 390 }
393 391
394 void PanelBrowserWindowGtk::UpdatePanelTitleBar() { 392 void PanelBrowserWindowGtk::UpdatePanelTitleBar() {
395 UpdateTitleBar(); 393 UpdateTitleBar();
396 } 394 }
397 395
398 void PanelBrowserWindowGtk::UpdatePanelLoadingAnimations(bool should_animate) { 396 void PanelBrowserWindowGtk::UpdatePanelLoadingAnimations(bool should_animate) {
399 UpdateLoadingAnimations(should_animate); 397 UpdateLoadingAnimations(should_animate);
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 MessageLoopForUI::current()->RunAllPending(); 875 MessageLoopForUI::current()->RunAllPending();
878 } 876 }
879 877
880 bool NativePanelTestingGtk::IsWindowSizeKnown() const { 878 bool NativePanelTestingGtk::IsWindowSizeKnown() const {
881 return panel_browser_window_gtk_->window_size_known_; 879 return panel_browser_window_gtk_->window_size_known_;
882 } 880 }
883 881
884 bool NativePanelTestingGtk::IsAnimatingBounds() const { 882 bool NativePanelTestingGtk::IsAnimatingBounds() const {
885 return panel_browser_window_gtk_->IsAnimatingBounds(); 883 return panel_browser_window_gtk_->IsAnimatingBounds();
886 } 884 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_window_gtk.h ('k') | chrome/browser/ui/panels/panel_window_controller_cocoa.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698