| 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, |
| 853 bool ask_permission) { |
| 853 // gtk_window_(un)fullscreen asks the window manager to toggle the EWMH | 854 // gtk_window_(un)fullscreen asks the window manager to toggle the EWMH |
| 854 // for fullscreen windows. Not all window managers support this. | 855 // for fullscreen windows. Not all window managers support this. |
| 855 if (fullscreen) { | 856 if (fullscreen) { |
| 856 gtk_window_fullscreen(window_); | 857 gtk_window_fullscreen(window_); |
| 858 bool is_kiosk = |
| 859 CommandLine::ForCurrentProcess()->HasSwitch(switches::kKioskMode); |
| 860 if (!is_kiosk) { |
| 861 fullscreen_exit_bubble_.reset(new FullscreenExitBubbleGtk( |
| 862 GTK_FLOATING_CONTAINER(render_area_floating_container_), |
| 863 browser(), |
| 864 url, |
| 865 ask_permission)); |
| 866 } |
| 857 } else { | 867 } else { |
| 858 // Work around a bug where if we try to unfullscreen, metacity immediately | 868 // 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 | 869 // 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 | 870 // there's a gnome-panel, but it's not easy to detect whether there's a |
| 861 // panel or not. | 871 // panel or not. |
| 862 std::string wm_name; | 872 std::string wm_name; |
| 863 bool unmaximize_before_unfullscreen = IsMaximized() && | 873 bool unmaximize_before_unfullscreen = IsMaximized() && |
| 864 ui::GetWindowManagerName(&wm_name) && wm_name == "Metacity"; | 874 ui::GetWindowManagerName(&wm_name) && wm_name == "Metacity"; |
| 865 if (unmaximize_before_unfullscreen) | 875 if (unmaximize_before_unfullscreen) |
| 866 UnMaximize(); | 876 UnMaximize(); |
| (...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2416 wm_name == "Openbox" || | 2426 wm_name == "Openbox" || |
| 2417 wm_name == "Xfwm4"); | 2427 wm_name == "Xfwm4"); |
| 2418 } | 2428 } |
| 2419 | 2429 |
| 2420 // static | 2430 // static |
| 2421 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2431 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
| 2422 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2432 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
| 2423 browser_window_gtk->Init(); | 2433 browser_window_gtk->Init(); |
| 2424 return browser_window_gtk; | 2434 return browser_window_gtk; |
| 2425 } | 2435 } |
| OLD | NEW |