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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" | 68 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" |
69 #include "chrome/browser/ui/gtk/task_manager_gtk.h" | 69 #include "chrome/browser/ui/gtk/task_manager_gtk.h" |
70 #include "chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h" | 70 #include "chrome/browser/ui/gtk/theme_install_bubble_view_gtk.h" |
71 #include "chrome/browser/ui/gtk/update_recommended_dialog.h" | 71 #include "chrome/browser/ui/gtk/update_recommended_dialog.h" |
72 #include "chrome/browser/ui/omnibox/location_bar.h" | 72 #include "chrome/browser/ui/omnibox/location_bar.h" |
73 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 73 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
74 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 74 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
75 #include "chrome/browser/ui/webui/bug_report_ui.h" | 75 #include "chrome/browser/ui/webui/bug_report_ui.h" |
76 #include "chrome/browser/ui/window_sizer.h" | 76 #include "chrome/browser/ui/window_sizer.h" |
77 #include "chrome/browser/web_applications/web_app.h" | 77 #include "chrome/browser/web_applications/web_app.h" |
| 78 #include "chrome/common/chrome_notification_types.h" |
78 #include "chrome/common/chrome_switches.h" | 79 #include "chrome/common/chrome_switches.h" |
79 #include "chrome/common/pref_names.h" | 80 #include "chrome/common/pref_names.h" |
80 #include "content/browser/debugger/devtools_window.h" | 81 #include "content/browser/debugger/devtools_window.h" |
81 #include "content/browser/renderer_host/render_view_host.h" | 82 #include "content/browser/renderer_host/render_view_host.h" |
82 #include "content/browser/renderer_host/render_widget_host_view.h" | 83 #include "content/browser/renderer_host/render_widget_host_view.h" |
83 #include "content/browser/tab_contents/tab_contents.h" | 84 #include "content/browser/tab_contents/tab_contents.h" |
84 #include "content/browser/tab_contents/tab_contents_view.h" | 85 #include "content/browser/tab_contents/tab_contents_view.h" |
85 #include "content/common/native_web_keyboard_event.h" | 86 #include "content/common/native_web_keyboard_event.h" |
86 #include "content/common/notification_service.h" | 87 #include "content/common/notification_service.h" |
87 #include "content/common/view_messages.h" | 88 #include "content/common/view_messages.h" |
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1154 | 1155 |
1155 WindowOpenDisposition BrowserWindowGtk::GetDispositionForPopupBounds( | 1156 WindowOpenDisposition BrowserWindowGtk::GetDispositionForPopupBounds( |
1156 const gfx::Rect& bounds) { | 1157 const gfx::Rect& bounds) { |
1157 return NEW_POPUP; | 1158 return NEW_POPUP; |
1158 } | 1159 } |
1159 | 1160 |
1160 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { | 1161 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { |
1161 new DownloadInProgressDialogGtk(browser()); | 1162 new DownloadInProgressDialogGtk(browser()); |
1162 } | 1163 } |
1163 | 1164 |
1164 void BrowserWindowGtk::Observe(NotificationType type, | 1165 void BrowserWindowGtk::Observe(int type, |
1165 const NotificationSource& source, | 1166 const NotificationSource& source, |
1166 const NotificationDetails& details) { | 1167 const NotificationDetails& details) { |
1167 switch (type.value) { | 1168 switch (type) { |
1168 case NotificationType::PREF_CHANGED: { | 1169 case chrome::NOTIFICATION_PREF_CHANGED: { |
1169 std::string* pref_name = Details<std::string>(details).ptr(); | 1170 std::string* pref_name = Details<std::string>(details).ptr(); |
1170 if (*pref_name == prefs::kUseCustomChromeFrame) { | 1171 if (*pref_name == prefs::kUseCustomChromeFrame) { |
1171 UpdateCustomFrame(); | 1172 UpdateCustomFrame(); |
1172 } else { | 1173 } else { |
1173 NOTREACHED() << "Got pref change notification we didn't register for!"; | 1174 NOTREACHED() << "Got pref change notification we didn't register for!"; |
1174 } | 1175 } |
1175 break; | 1176 break; |
1176 } | 1177 } |
1177 | 1178 |
1178 default: | 1179 default: |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1501 // Tab strip isn't empty. Hide the window (so it appears to have closed | 1502 // Tab strip isn't empty. Hide the window (so it appears to have closed |
1502 // immediately) and close all the tabs, allowing the renderers to shut | 1503 // immediately) and close all the tabs, allowing the renderers to shut |
1503 // down. When the tab strip is empty we'll be called back again. | 1504 // down. When the tab strip is empty we'll be called back again. |
1504 gtk_widget_hide(GTK_WIDGET(window_)); | 1505 gtk_widget_hide(GTK_WIDGET(window_)); |
1505 browser_->OnWindowClosing(); | 1506 browser_->OnWindowClosing(); |
1506 return false; | 1507 return false; |
1507 } | 1508 } |
1508 | 1509 |
1509 // Empty TabStripModel, it's now safe to allow the Window to be closed. | 1510 // Empty TabStripModel, it's now safe to allow the Window to be closed. |
1510 NotificationService::current()->Notify( | 1511 NotificationService::current()->Notify( |
1511 NotificationType::WINDOW_CLOSED, | 1512 chrome::NOTIFICATION_WINDOW_CLOSED, |
1512 Source<GtkWindow>(window_), | 1513 Source<GtkWindow>(window_), |
1513 NotificationService::NoDetails()); | 1514 NotificationService::NoDetails()); |
1514 return true; | 1515 return true; |
1515 } | 1516 } |
1516 | 1517 |
1517 bool BrowserWindowGtk::ShouldShowWindowIcon() const { | 1518 bool BrowserWindowGtk::ShouldShowWindowIcon() const { |
1518 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); | 1519 return browser_->SupportsWindowFeature(Browser::FEATURE_TITLEBAR); |
1519 } | 1520 } |
1520 | 1521 |
1521 void BrowserWindowGtk::DisableDebounceTimerForTests(bool is_disabled) { | 1522 void BrowserWindowGtk::DisableDebounceTimerForTests(bool is_disabled) { |
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2356 // are taken from the WMs' source code. | 2357 // are taken from the WMs' source code. |
2357 return (wm_name == "Blackbox" || | 2358 return (wm_name == "Blackbox" || |
2358 wm_name == "compiz" || | 2359 wm_name == "compiz" || |
2359 wm_name == "Compiz" || | 2360 wm_name == "Compiz" || |
2360 wm_name == "e16" || // Enlightenment DR16 | 2361 wm_name == "e16" || // Enlightenment DR16 |
2361 wm_name == "Metacity" || | 2362 wm_name == "Metacity" || |
2362 wm_name == "Mutter" || | 2363 wm_name == "Mutter" || |
2363 wm_name == "Openbox" || | 2364 wm_name == "Openbox" || |
2364 wm_name == "Xfwm4"); | 2365 wm_name == "Xfwm4"); |
2365 } | 2366 } |
OLD | NEW |