| 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/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include <dlfcn.h> | 9 #include <dlfcn.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 785 |
| 786 void BrowserWindowGtk::UpdateDevTools() { | 786 void BrowserWindowGtk::UpdateDevTools() { |
| 787 UpdateDevToolsForContents( | 787 UpdateDevToolsForContents( |
| 788 browser_->GetSelectedTabContents()); | 788 browser_->GetSelectedTabContents()); |
| 789 } | 789 } |
| 790 | 790 |
| 791 void BrowserWindowGtk::UpdateLoadingAnimations(bool should_animate) { | 791 void BrowserWindowGtk::UpdateLoadingAnimations(bool should_animate) { |
| 792 if (should_animate) { | 792 if (should_animate) { |
| 793 if (!loading_animation_timer_.IsRunning()) { | 793 if (!loading_animation_timer_.IsRunning()) { |
| 794 // Loads are happening, and the timer isn't running, so start it. | 794 // Loads are happening, and the timer isn't running, so start it. |
| 795 loading_animation_timer_.Start(FROM_HERE, | 795 loading_animation_timer_.Start( |
| 796 base::TimeDelta::FromMilliseconds(kLoadingAnimationFrameTimeMs), this, | 796 base::TimeDelta::FromMilliseconds(kLoadingAnimationFrameTimeMs), this, |
| 797 &BrowserWindowGtk::LoadingAnimationCallback); | 797 &BrowserWindowGtk::LoadingAnimationCallback); |
| 798 } | 798 } |
| 799 } else { | 799 } else { |
| 800 if (loading_animation_timer_.IsRunning()) { | 800 if (loading_animation_timer_.IsRunning()) { |
| 801 loading_animation_timer_.Stop(); | 801 loading_animation_timer_.Stop(); |
| 802 // Loads are now complete, update the state if a task was scheduled. | 802 // Loads are now complete, update the state if a task was scheduled. |
| 803 LoadingAnimationCallback(); | 803 LoadingAnimationCallback(); |
| 804 } | 804 } |
| 805 } | 805 } |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 // than any window manager decorations, if enabled), so we need to call | 1412 // than any window manager decorations, if enabled), so we need to call |
| 1413 // gtk_window_get_position() to get the right values. (Otherwise session | 1413 // gtk_window_get_position() to get the right values. (Otherwise session |
| 1414 // restore, if enabled, will restore windows to incorrect positions.) That's | 1414 // restore, if enabled, will restore windows to incorrect positions.) That's |
| 1415 // a round trip to the X server though, so we set a debounce timer and only | 1415 // a round trip to the X server though, so we set a debounce timer and only |
| 1416 // call it (in OnDebouncedBoundsChanged() below) after we haven't seen a | 1416 // call it (in OnDebouncedBoundsChanged() below) after we haven't seen a |
| 1417 // reconfigure event in a short while. | 1417 // reconfigure event in a short while. |
| 1418 // We don't use Reset() because the timer may not yet be running. | 1418 // We don't use Reset() because the timer may not yet be running. |
| 1419 // (In that case Stop() is a no-op.) | 1419 // (In that case Stop() is a no-op.) |
| 1420 if (!debounce_timer_disabled_) { | 1420 if (!debounce_timer_disabled_) { |
| 1421 window_configure_debounce_timer_.Stop(); | 1421 window_configure_debounce_timer_.Stop(); |
| 1422 window_configure_debounce_timer_.Start(FROM_HERE, | 1422 window_configure_debounce_timer_.Start(base::TimeDelta::FromMilliseconds( |
| 1423 base::TimeDelta::FromMilliseconds(kDebounceTimeoutMilliseconds), this, | 1423 kDebounceTimeoutMilliseconds), this, |
| 1424 &BrowserWindowGtk::OnDebouncedBoundsChanged); | 1424 &BrowserWindowGtk::OnDebouncedBoundsChanged); |
| 1425 } | 1425 } |
| 1426 | 1426 |
| 1427 return FALSE; | 1427 return FALSE; |
| 1428 } | 1428 } |
| 1429 | 1429 |
| 1430 void BrowserWindowGtk::OnDebouncedBoundsChanged() { | 1430 void BrowserWindowGtk::OnDebouncedBoundsChanged() { |
| 1431 gint x, y; | 1431 gint x, y; |
| 1432 gtk_window_get_position(window_, &x, &y); | 1432 gtk_window_get_position(window_, &x, &y); |
| 1433 gfx::Point origin(x, y); | 1433 gfx::Point origin(x, y); |
| (...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 // are taken from the WMs' source code. | 2370 // are taken from the WMs' source code. |
| 2371 return (wm_name == "Blackbox" || | 2371 return (wm_name == "Blackbox" || |
| 2372 wm_name == "compiz" || | 2372 wm_name == "compiz" || |
| 2373 wm_name == "Compiz" || | 2373 wm_name == "Compiz" || |
| 2374 wm_name == "e16" || // Enlightenment DR16 | 2374 wm_name == "e16" || // Enlightenment DR16 |
| 2375 wm_name == "Metacity" || | 2375 wm_name == "Metacity" || |
| 2376 wm_name == "Mutter" || | 2376 wm_name == "Mutter" || |
| 2377 wm_name == "Openbox" || | 2377 wm_name == "Openbox" || |
| 2378 wm_name == "Xfwm4"); | 2378 wm_name == "Xfwm4"); |
| 2379 } | 2379 } |
| OLD | NEW |