OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/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 <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 FindBar* BrowserWindowGtk::CreateFindBar() { | 1138 FindBar* BrowserWindowGtk::CreateFindBar() { |
1139 return new FindBarGtk(this); | 1139 return new FindBarGtk(this); |
1140 } | 1140 } |
1141 | 1141 |
1142 bool BrowserWindowGtk::GetConstrainedWindowTopY(int* top_y) { | 1142 bool BrowserWindowGtk::GetConstrainedWindowTopY(int* top_y) { |
1143 return false; | 1143 return false; |
1144 } | 1144 } |
1145 | 1145 |
1146 void BrowserWindowGtk::ShowAvatarBubble(WebContents* web_contents, | 1146 void BrowserWindowGtk::ShowAvatarBubble(WebContents* web_contents, |
1147 const gfx::Rect& rect) { | 1147 const gfx::Rect& rect) { |
1148 GtkWidget* widget = web_contents->GetContentNativeView(); | 1148 GtkWidget* widget = web_contents->GetView()->GetContentNativeView(); |
1149 new AvatarMenuBubbleGtk(browser_.get(), widget, | 1149 new AvatarMenuBubbleGtk(browser_.get(), widget, |
1150 BubbleGtk::ANCHOR_TOP_LEFT, &rect); | 1150 BubbleGtk::ANCHOR_TOP_LEFT, &rect); |
1151 } | 1151 } |
1152 | 1152 |
1153 void BrowserWindowGtk::ShowAvatarBubbleFromAvatarButton() { | 1153 void BrowserWindowGtk::ShowAvatarBubbleFromAvatarButton() { |
1154 if (titlebar_->avatar_button()) | 1154 if (titlebar_->avatar_button()) |
1155 titlebar_->avatar_button()->ShowAvatarBubble(); | 1155 titlebar_->avatar_button()->ShowAvatarBubble(); |
1156 } | 1156 } |
1157 | 1157 |
1158 void BrowserWindowGtk::ShowPasswordGenerationBubble( | 1158 void BrowserWindowGtk::ShowPasswordGenerationBubble( |
1159 const gfx::Rect& rect, | 1159 const gfx::Rect& rect, |
1160 const content::PasswordForm& form, | 1160 const content::PasswordForm& form, |
1161 autofill::PasswordGenerator* password_generator) { | 1161 autofill::PasswordGenerator* password_generator) { |
1162 WebContents* web_contents = | 1162 WebContents* web_contents = |
1163 browser_->tab_strip_model()->GetActiveWebContents(); | 1163 browser_->tab_strip_model()->GetActiveWebContents(); |
1164 if (!web_contents || !web_contents->GetContentNativeView()) { | 1164 if (!web_contents || !web_contents->GetView()->GetContentNativeView()) { |
1165 return; | 1165 return; |
1166 } | 1166 } |
1167 | 1167 |
1168 new PasswordGenerationBubbleGtk(rect, form, web_contents, password_generator); | 1168 new PasswordGenerationBubbleGtk(rect, form, web_contents, password_generator); |
1169 } | 1169 } |
1170 | 1170 |
1171 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { | 1171 void BrowserWindowGtk::ConfirmBrowserCloseWithPendingDownloads() { |
1172 DownloadInProgressDialogGtk::Show(browser(), GetNativeWindow()); | 1172 DownloadInProgressDialogGtk::Show(browser(), GetNativeWindow()); |
1173 } | 1173 } |
1174 | 1174 |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1977 // handler registered (it should take precedence). | 1977 // handler registered (it should take precedence). |
1978 gboolean BrowserWindowGtk::OnKeyPress(GtkWidget* widget, GdkEventKey* event) { | 1978 gboolean BrowserWindowGtk::OnKeyPress(GtkWidget* widget, GdkEventKey* event) { |
1979 if (extension_keybinding_registry_->HasPriorityHandler(event)) | 1979 if (extension_keybinding_registry_->HasPriorityHandler(event)) |
1980 return FALSE; | 1980 return FALSE; |
1981 | 1981 |
1982 // If a widget besides the native view is focused, we have to try to handle | 1982 // If a widget besides the native view is focused, we have to try to handle |
1983 // the custom accelerators before letting it handle them. | 1983 // the custom accelerators before letting it handle them. |
1984 WebContents* current_web_contents = | 1984 WebContents* current_web_contents = |
1985 browser()->tab_strip_model()->GetActiveWebContents(); | 1985 browser()->tab_strip_model()->GetActiveWebContents(); |
1986 // The current tab might not have a render view if it crashed. | 1986 // The current tab might not have a render view if it crashed. |
1987 if (!current_web_contents || !current_web_contents->GetContentNativeView() || | 1987 if (!current_web_contents || |
1988 !gtk_widget_is_focus(current_web_contents->GetContentNativeView())) { | 1988 !current_web_contents->GetView()->GetContentNativeView() || |
| 1989 !gtk_widget_is_focus( |
| 1990 current_web_contents->GetView()->GetContentNativeView())) { |
1989 int command_id = GetCustomCommandId(event); | 1991 int command_id = GetCustomCommandId(event); |
1990 if (command_id == -1) | 1992 if (command_id == -1) |
1991 command_id = GetPreHandleCommandId(event); | 1993 command_id = GetPreHandleCommandId(event); |
1992 | 1994 |
1993 if (command_id != -1 && chrome::ExecuteCommand(browser_.get(), command_id)) | 1995 if (command_id != -1 && chrome::ExecuteCommand(browser_.get(), command_id)) |
1994 return TRUE; | 1996 return TRUE; |
1995 | 1997 |
1996 // Propagate the key event to child widget first, so we don't override their | 1998 // Propagate the key event to child widget first, so we don't override their |
1997 // accelerators. | 1999 // accelerators. |
1998 if (!gtk_window_propagate_key_event(GTK_WINDOW(widget), event)) { | 2000 if (!gtk_window_propagate_key_event(GTK_WINDOW(widget), event)) { |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2406 wm_type == ui::WM_OPENBOX || | 2408 wm_type == ui::WM_OPENBOX || |
2407 wm_type == ui::WM_XFWM4); | 2409 wm_type == ui::WM_XFWM4); |
2408 } | 2410 } |
2409 | 2411 |
2410 // static | 2412 // static |
2411 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { | 2413 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { |
2412 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); | 2414 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); |
2413 browser_window_gtk->Init(); | 2415 browser_window_gtk->Init(); |
2414 return browser_window_gtk; | 2416 return browser_window_gtk; |
2415 } | 2417 } |
OLD | NEW |