| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 if (exterior) { | 680 if (exterior) { |
| 681 SetWindowSize(window_, gfx::Size(width, height)); | 681 SetWindowSize(window_, gfx::Size(width, height)); |
| 682 } else { | 682 } else { |
| 683 gtk_widget_set_size_request(contents_container_->widget(), | 683 gtk_widget_set_size_request(contents_container_->widget(), |
| 684 width, height); | 684 width, height); |
| 685 } | 685 } |
| 686 } | 686 } |
| 687 | 687 |
| 688 void BrowserWindowGtk::SetBounds(const gfx::Rect& bounds) { | 688 void BrowserWindowGtk::SetBounds(const gfx::Rect& bounds) { |
| 689 if (IsFullscreen()) | 689 if (IsFullscreen()) |
| 690 SetFullscreen(false); | 690 SetFullscreen(false, GURL(), false); |
| 691 SetBoundsImpl(bounds, true, true); | 691 SetBoundsImpl(bounds, true, true); |
| 692 } | 692 } |
| 693 | 693 |
| 694 void BrowserWindowGtk::Close() { | 694 void BrowserWindowGtk::Close() { |
| 695 // We're already closing. Do nothing. | 695 // We're already closing. Do nothing. |
| 696 if (!window_) | 696 if (!window_) |
| 697 return; | 697 return; |
| 698 | 698 |
| 699 if (!CanClose()) | 699 if (!CanClose()) |
| 700 return; | 700 return; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 } | 842 } |
| 843 | 843 |
| 844 bool BrowserWindowGtk::IsMinimized() const { | 844 bool BrowserWindowGtk::IsMinimized() const { |
| 845 return (state_ & GDK_WINDOW_STATE_ICONIFIED); | 845 return (state_ & GDK_WINDOW_STATE_ICONIFIED); |
| 846 } | 846 } |
| 847 | 847 |
| 848 bool BrowserWindowGtk::ShouldDrawContentDropShadow() { | 848 bool BrowserWindowGtk::ShouldDrawContentDropShadow() { |
| 849 return !IsMaximized() && UseCustomFrame(); | 849 return !IsMaximized() && UseCustomFrame(); |
| 850 } | 850 } |
| 851 | 851 |
| 852 void BrowserWindowGtk::SetFullscreen(bool fullscreen) { | 852 void BrowserWindowGtk::SetFullscreen(bool fullscreen, const GURL& url, bool show
_buttons) { |
| 853 // gtk_window_(un)fullscreen asks the window manager to toggle the EWMH | 853 // gtk_window_(un)fullscreen asks the window manager to toggle the EWMH |
| 854 // for fullscreen windows. Not all window managers support this. | 854 // for fullscreen windows. Not all window managers support this. |
| 855 if (fullscreen) { | 855 if (fullscreen) { |
| 856 gtk_window_fullscreen(window_); | 856 gtk_window_fullscreen(window_); |
| 857 bool is_kiosk = |
| 858 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); |
| 859 if (!is_kiosk) { |
| 860 fullscreen_exit_bubble_.reset(new FullscreenExitBubbleGtk( |
| 861 GTK_FLOATING_CONTAINER(render_area_floating_container_), |
| 862 browser(), |
| 863 url, |
| 864 show_buttons)); |
| 865 } |
| 857 } else { | 866 } else { |
| 858 // Work around a bug where if we try to unfullscreen, metacity immediately | 867 // Work around a bug where if we try to unfullscreen, metacity immediately |
| 859 // fullscreens us again. This is a little flickery and not necessary if | 868 // fullscreens us again. This is a little flickery and not necessary if |
| 860 // there's a gnome-panel, but it's not easy to detect whether there's a | 869 // there's a gnome-panel, but it's not easy to detect whether there's a |
| 861 // panel or not. | 870 // panel or not. |
| 862 std::string wm_name; | 871 std::string wm_name; |
| 863 bool unmaximize_before_unfullscreen = IsMaximized() && | 872 bool unmaximize_before_unfullscreen = IsMaximized() && |
| 864 ui::GetWindowManagerName(&wm_name) && wm_name == "Metacity"; | 873 ui::GetWindowManagerName(&wm_name) && wm_name == "Metacity"; |
| 865 if (unmaximize_before_unfullscreen) | 874 if (unmaximize_before_unfullscreen) |
| 866 UnMaximize(); | 875 UnMaximize(); |
| (...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2414 wm_name == "Openbox" || | 2423 wm_name == "Openbox" || |
| 2415 wm_name == "Xfwm4"); | 2424 wm_name == "Xfwm4"); |
| 2416 } | 2425 } |
| 2417 | 2426 |
| 2418 // static | 2427 // static |
| 2419 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2428 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2420 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2429 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2421 browser_window_gtk->Init(); | 2430 browser_window_gtk->Init(); |
| 2422 return browser_window_gtk; | 2431 return browser_window_gtk; |
| 2423 } | 2432 } |
| OLD | NEW |