Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: chrome/browser/ui/gtk/browser_window_gtk.cc

Issue 10545115: TabContentsWrapper -> TabContents, part 41. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 #include "chrome/browser/ui/gtk/reload_button_gtk.h" 67 #include "chrome/browser/ui/gtk/reload_button_gtk.h"
68 #include "chrome/browser/ui/gtk/status_bubble_gtk.h" 68 #include "chrome/browser/ui/gtk/status_bubble_gtk.h"
69 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h" 69 #include "chrome/browser/ui/gtk/tab_contents_container_gtk.h"
70 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h" 70 #include "chrome/browser/ui/gtk/tabs/tab_strip_gtk.h"
71 #include "chrome/browser/ui/gtk/task_manager_gtk.h" 71 #include "chrome/browser/ui/gtk/task_manager_gtk.h"
72 #include "chrome/browser/ui/gtk/update_recommended_dialog.h" 72 #include "chrome/browser/ui/gtk/update_recommended_dialog.h"
73 #include "chrome/browser/ui/gtk/website_settings_popup_gtk.h" 73 #include "chrome/browser/ui/gtk/website_settings_popup_gtk.h"
74 #include "chrome/browser/ui/omnibox/location_bar.h" 74 #include "chrome/browser/ui/omnibox/location_bar.h"
75 #include "chrome/browser/ui/omnibox/omnibox_view.h" 75 #include "chrome/browser/ui/omnibox/omnibox_view.h"
76 #include "chrome/browser/ui/page_info_bubble.h" 76 #include "chrome/browser/ui/page_info_bubble.h"
77 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 77 #include "chrome/browser/ui/tab_contents/tab_contents.h"
78 #include "chrome/browser/ui/tabs/tab_strip_model.h" 78 #include "chrome/browser/ui/tabs/tab_strip_model.h"
79 #include "chrome/browser/web_applications/web_app.h" 79 #include "chrome/browser/web_applications/web_app.h"
80 #include "chrome/common/chrome_notification_types.h" 80 #include "chrome/common/chrome_notification_types.h"
81 #include "chrome/common/chrome_switches.h" 81 #include "chrome/common/chrome_switches.h"
82 #include "chrome/common/pref_names.h" 82 #include "chrome/common/pref_names.h"
83 #include "content/public/browser/download_manager.h" 83 #include "content/public/browser/download_manager.h"
84 #include "content/public/browser/native_web_keyboard_event.h" 84 #include "content/public/browser/native_web_keyboard_event.h"
85 #include "content/public/browser/notification_service.h" 85 #include "content/public/browser/notification_service.h"
86 #include "content/public/browser/render_view_host.h" 86 #include "content/public/browser/render_view_host.h"
87 #include "content/public/browser/render_widget_host_view.h" 87 #include "content/public/browser/render_widget_host_view.h"
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 titlebar_->UpdateTitleAndIcon(); 826 titlebar_->UpdateTitleAndIcon();
827 } 827 }
828 828
829 void BrowserWindowGtk::BookmarkBarStateChanged( 829 void BrowserWindowGtk::BookmarkBarStateChanged(
830 BookmarkBar::AnimateChangeType change_type) { 830 BookmarkBar::AnimateChangeType change_type) {
831 MaybeShowBookmarkBar(change_type == BookmarkBar::ANIMATE_STATE_CHANGE); 831 MaybeShowBookmarkBar(change_type == BookmarkBar::ANIMATE_STATE_CHANGE);
832 } 832 }
833 833
834 void BrowserWindowGtk::UpdateDevTools() { 834 void BrowserWindowGtk::UpdateDevTools() {
835 UpdateDevToolsForContents( 835 UpdateDevToolsForContents(
836 browser_->GetSelectedWebContents()); 836 browser_->GetActiveWebContents());
837 } 837 }
838 838
839 void BrowserWindowGtk::SetDevToolsDockSide(DevToolsDockSide side) { 839 void BrowserWindowGtk::SetDevToolsDockSide(DevToolsDockSide side) {
840 if (devtools_dock_side_ == side) 840 if (devtools_dock_side_ == side)
841 return; 841 return;
842 842
843 if (devtools_container_->tab()) { 843 if (devtools_container_->tab()) {
844 HideDevToolsContainer(); 844 HideDevToolsContainer();
845 devtools_dock_side_ = side; 845 devtools_dock_side_ = side;
846 ShowDevToolsContainer(); 846 ShowDevToolsContainer();
(...skipping 22 matching lines...) Expand all
869 void BrowserWindowGtk::LoadingAnimationCallback() { 869 void BrowserWindowGtk::LoadingAnimationCallback() {
870 if (browser_->is_type_tabbed()) { 870 if (browser_->is_type_tabbed()) {
871 // Loading animations are shown in the tab for tabbed windows. We check the 871 // Loading animations are shown in the tab for tabbed windows. We check the
872 // browser type instead of calling IsTabStripVisible() because the latter 872 // browser type instead of calling IsTabStripVisible() because the latter
873 // will return false for fullscreen windows, but we still need to update 873 // will return false for fullscreen windows, but we still need to update
874 // their animations (so that when they come out of fullscreen mode they'll 874 // their animations (so that when they come out of fullscreen mode they'll
875 // be correct). 875 // be correct).
876 tabstrip_->UpdateLoadingAnimations(); 876 tabstrip_->UpdateLoadingAnimations();
877 } else if (ShouldShowWindowIcon()) { 877 } else if (ShouldShowWindowIcon()) {
878 // ... or in the window icon area for popups and app windows. 878 // ... or in the window icon area for popups and app windows.
879 WebContents* web_contents = browser_->GetSelectedWebContents(); 879 WebContents* web_contents = browser_->GetActiveWebContents();
880 // GetSelectedTabContents can return NULL for example under Purify when 880 // GetSelectedTabContents can return NULL for example under Purify when
881 // the animations are running slowly and this function is called on 881 // the animations are running slowly and this function is called on
882 // a timer through LoadingAnimationCallback. 882 // a timer through LoadingAnimationCallback.
883 titlebar_->UpdateThrobber(web_contents); 883 titlebar_->UpdateThrobber(web_contents);
884 } 884 }
885 } 885 }
886 886
887 void BrowserWindowGtk::SetStarredState(bool is_starred) { 887 void BrowserWindowGtk::SetStarredState(bool is_starred) {
888 toolbar_->GetLocationBarView()->SetStarred(is_starred); 888 toolbar_->GetLocationBarView()->SetStarred(is_starred);
889 } 889 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 if (!IsFullscreen()) 991 if (!IsFullscreen())
992 GetLocationBar()->FocusLocation(select_all); 992 GetLocationBar()->FocusLocation(select_all);
993 } 993 }
994 994
995 void BrowserWindowGtk::UpdateReloadStopState(bool is_loading, bool force) { 995 void BrowserWindowGtk::UpdateReloadStopState(bool is_loading, bool force) {
996 toolbar_->GetReloadButton()->ChangeMode( 996 toolbar_->GetReloadButton()->ChangeMode(
997 is_loading ? ReloadButtonGtk::MODE_STOP : ReloadButtonGtk::MODE_RELOAD, 997 is_loading ? ReloadButtonGtk::MODE_STOP : ReloadButtonGtk::MODE_RELOAD,
998 force); 998 force);
999 } 999 }
1000 1000
1001 void BrowserWindowGtk::UpdateToolbar(TabContentsWrapper* contents, 1001 void BrowserWindowGtk::UpdateToolbar(TabContents* contents,
1002 bool should_restore_state) { 1002 bool should_restore_state) {
1003 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::UpdateToolbar"); 1003 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::UpdateToolbar");
1004 toolbar_->UpdateWebContents(contents->web_contents(), should_restore_state); 1004 toolbar_->UpdateWebContents(contents->web_contents(), should_restore_state);
1005 } 1005 }
1006 1006
1007 void BrowserWindowGtk::FocusToolbar() { 1007 void BrowserWindowGtk::FocusToolbar() {
1008 NOTIMPLEMENTED(); 1008 NOTIMPLEMENTED();
1009 } 1009 }
1010 1010
1011 void BrowserWindowGtk::FocusAppMenu() { 1011 void BrowserWindowGtk::FocusAppMenu() {
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 void BrowserWindowGtk::ShowPageInfo(Profile* profile, 1123 void BrowserWindowGtk::ShowPageInfo(Profile* profile,
1124 const GURL& url, 1124 const GURL& url,
1125 const SSLStatus& ssl, 1125 const SSLStatus& ssl,
1126 bool show_history) { 1126 bool show_history) {
1127 browser::ShowPageInfoBubble(window_, profile, url, ssl, show_history, 1127 browser::ShowPageInfoBubble(window_, profile, url, ssl, show_history,
1128 browser_.get()); 1128 browser_.get());
1129 } 1129 }
1130 1130
1131 void BrowserWindowGtk::ShowWebsiteSettings( 1131 void BrowserWindowGtk::ShowWebsiteSettings(
1132 Profile* profile, 1132 Profile* profile,
1133 TabContentsWrapper* tab_contents_wrapper, 1133 TabContents* tab_contents,
1134 const GURL& url, 1134 const GURL& url,
1135 const content::SSLStatus& ssl, 1135 const content::SSLStatus& ssl,
1136 bool show_history) { 1136 bool show_history) {
1137 WebsiteSettingsPopupGtk::Show(GetNativeWindow(), profile, 1137 WebsiteSettingsPopupGtk::Show(GetNativeWindow(), profile,
1138 tab_contents_wrapper, url, ssl); 1138 tab_contents, url, ssl);
1139 } 1139 }
1140 1140
1141 void BrowserWindowGtk::ShowAppMenu() { 1141 void BrowserWindowGtk::ShowAppMenu() {
1142 toolbar_->ShowAppMenu(); 1142 toolbar_->ShowAppMenu();
1143 } 1143 }
1144 1144
1145 bool BrowserWindowGtk::PreHandleKeyboardEvent( 1145 bool BrowserWindowGtk::PreHandleKeyboardEvent(
1146 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { 1146 const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) {
1147 GdkEventKey* os_event = &event.os_event->key; 1147 GdkEventKey* os_event = &event.os_event->key;
1148 1148
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 // It's not necessary to care about the keyboard layout, as 1217 // It's not necessary to care about the keyboard layout, as
1218 // gtk_window_activate_key() takes care of it automatically. 1218 // gtk_window_activate_key() takes care of it automatically.
1219 int id = GetCustomCommandId(os_event); 1219 int id = GetCustomCommandId(os_event);
1220 if (id != -1) 1220 if (id != -1)
1221 browser_->ExecuteCommandIfEnabled(id); 1221 browser_->ExecuteCommandIfEnabled(id);
1222 else 1222 else
1223 gtk_window_activate_key(window_, os_event); 1223 gtk_window_activate_key(window_, os_event);
1224 } 1224 }
1225 1225
1226 void BrowserWindowGtk::ShowCreateWebAppShortcutsDialog( 1226 void BrowserWindowGtk::ShowCreateWebAppShortcutsDialog(
1227 TabContentsWrapper* tab_contents) { 1227 TabContents* tab_contents) {
1228 CreateWebApplicationShortcutsDialogGtk::Show(window_, tab_contents); 1228 CreateWebApplicationShortcutsDialogGtk::Show(window_, tab_contents);
1229 } 1229 }
1230 1230
1231 void BrowserWindowGtk::ShowCreateChromeAppShortcutsDialog( 1231 void BrowserWindowGtk::ShowCreateChromeAppShortcutsDialog(
1232 Profile* profile, const extensions::Extension* app) { 1232 Profile* profile, const extensions::Extension* app) {
1233 CreateChromeApplicationShortcutsDialogGtk::Show(window_, profile, app); 1233 CreateChromeApplicationShortcutsDialogGtk::Show(window_, profile, app);
1234 } 1234 }
1235 1235
1236 void BrowserWindowGtk::Cut() { 1236 void BrowserWindowGtk::Cut() {
1237 gtk_util::DoCut(this); 1237 gtk_util::DoCut(this);
1238 } 1238 }
1239 1239
1240 void BrowserWindowGtk::Copy() { 1240 void BrowserWindowGtk::Copy() {
1241 gtk_util::DoCopy(this); 1241 gtk_util::DoCopy(this);
1242 } 1242 }
1243 1243
1244 void BrowserWindowGtk::Paste() { 1244 void BrowserWindowGtk::Paste() {
1245 gtk_util::DoPaste(this); 1245 gtk_util::DoPaste(this);
1246 } 1246 }
1247 1247
1248 void BrowserWindowGtk::ShowInstant(TabContentsWrapper* preview) { 1248 void BrowserWindowGtk::ShowInstant(TabContents* preview) {
1249 contents_container_->SetPreview(preview); 1249 contents_container_->SetPreview(preview);
1250 MaybeShowBookmarkBar(false); 1250 MaybeShowBookmarkBar(false);
1251 } 1251 }
1252 1252
1253 void BrowserWindowGtk::HideInstant() { 1253 void BrowserWindowGtk::HideInstant() {
1254 contents_container_->PopPreview(); 1254 contents_container_->PopPreview();
1255 MaybeShowBookmarkBar(false); 1255 MaybeShowBookmarkBar(false);
1256 } 1256 }
1257 1257
1258 gfx::Rect BrowserWindowGtk::GetInstantBounds() { 1258 gfx::Rect BrowserWindowGtk::GetInstantBounds() {
(...skipping 18 matching lines...) Expand all
1277 1277
1278 void BrowserWindowGtk::ShowAvatarBubbleFromAvatarButton() { 1278 void BrowserWindowGtk::ShowAvatarBubbleFromAvatarButton() {
1279 if (titlebar_->avatar_button()) 1279 if (titlebar_->avatar_button())
1280 titlebar_->avatar_button()->ShowAvatarBubble(); 1280 titlebar_->avatar_button()->ShowAvatarBubble();
1281 } 1281 }
1282 1282
1283 void BrowserWindowGtk::ShowPasswordGenerationBubble( 1283 void BrowserWindowGtk::ShowPasswordGenerationBubble(
1284 const gfx::Rect& rect, 1284 const gfx::Rect& rect,
1285 autofill::PasswordGenerator* password_generator, 1285 autofill::PasswordGenerator* password_generator,
1286 const webkit::forms::PasswordForm& form) { 1286 const webkit::forms::PasswordForm& form) {
1287 WebContents* web_contents = browser_->GetSelectedWebContents(); 1287 WebContents* web_contents = browser_->GetActiveWebContents();
1288 if (!web_contents || !web_contents->GetContentNativeView()) { 1288 if (!web_contents || !web_contents->GetContentNativeView()) {
1289 return; 1289 return;
1290 } 1290 }
1291 1291
1292 TabContentsWrapper* tab_contents = 1292 TabContents* tab_contents = TabContents::FromWebContents(web_contents);
1293 TabContentsWrapper::GetCurrentWrapperForContents(web_contents);
1294 if (!tab_contents) 1293 if (!tab_contents)
1295 return; 1294 return;
1296 1295
1297 new PasswordGenerationBubbleGtk(rect, 1296 new PasswordGenerationBubbleGtk(rect,
1298 form, 1297 form,
1299 web_contents->GetContentNativeView(), 1298 web_contents->GetContentNativeView(),
1300 browser()->profile(), 1299 browser()->profile(),
1301 web_contents->GetRenderViewHost(), 1300 web_contents->GetRenderViewHost(),
1302 password_generator, 1301 password_generator,
1303 tab_contents->password_manager()); 1302 tab_contents->password_manager());
(...skipping 18 matching lines...) Expand all
1322 } 1321 }
1323 case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED: 1322 case chrome::NOTIFICATION_PROFILE_CACHED_INFO_CHANGED:
1324 // The profile avatar icon may have changed. 1323 // The profile avatar icon may have changed.
1325 gtk_util::SetWindowIcon(window_, browser_->profile()); 1324 gtk_util::SetWindowIcon(window_, browser_->profile());
1326 break; 1325 break;
1327 default: 1326 default:
1328 break; 1327 break;
1329 } 1328 }
1330 } 1329 }
1331 1330
1332 void BrowserWindowGtk::TabDetachedAt(TabContentsWrapper* contents, int index) { 1331 void BrowserWindowGtk::TabDetachedAt(TabContents* contents, int index) {
1333 // We use index here rather than comparing |contents| because by this time 1332 // We use index here rather than comparing |contents| because by this time
1334 // the model has already removed |contents| from its list, so 1333 // the model has already removed |contents| from its list, so
1335 // browser_->GetSelectedWebContents() will return NULL or something else. 1334 // browser_->GetActiveWebContents() will return NULL or something else.
1336 if (index == browser_->active_index()) { 1335 if (index == browser_->active_index()) {
1337 infobar_container_->ChangeTabContents(NULL); 1336 infobar_container_->ChangeTabContents(NULL);
1338 UpdateDevToolsForContents(NULL); 1337 UpdateDevToolsForContents(NULL);
1339 } 1338 }
1340 contents_container_->DetachTab(contents); 1339 contents_container_->DetachTab(contents);
1341 } 1340 }
1342 1341
1343 void BrowserWindowGtk::ActiveTabChanged(TabContentsWrapper* old_contents, 1342 void BrowserWindowGtk::ActiveTabChanged(TabContents* old_contents,
1344 TabContentsWrapper* new_contents, 1343 TabContents* new_contents,
1345 int index, 1344 int index,
1346 bool user_gesture) { 1345 bool user_gesture) {
1347 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::ActiveTabChanged"); 1346 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::ActiveTabChanged");
1348 if (old_contents && !old_contents->in_destructor()) 1347 if (old_contents && !old_contents->in_destructor())
1349 old_contents->web_contents()->GetView()->StoreFocus(); 1348 old_contents->web_contents()->GetView()->StoreFocus();
1350 1349
1351 // Update various elements that are interested in knowing the current 1350 // Update various elements that are interested in knowing the current
1352 // WebContents. 1351 // WebContents.
1353 UpdateDevToolsForContents(new_contents->web_contents()); 1352 UpdateDevToolsForContents(new_contents->web_contents());
1354 infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper()); 1353 infobar_container_->ChangeTabContents(new_contents->infobar_tab_helper());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1413 NOTREACHED(); 1412 NOTREACHED();
1414 } 1413 }
1415 return true; 1414 return true;
1416 } 1415 }
1417 1416
1418 void BrowserWindowGtk::MaybeShowBookmarkBar(bool animate) { 1417 void BrowserWindowGtk::MaybeShowBookmarkBar(bool animate) {
1419 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::MaybeShowBookmarkBar"); 1418 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::MaybeShowBookmarkBar");
1420 if (!IsBookmarkBarSupported()) 1419 if (!IsBookmarkBarSupported())
1421 return; 1420 return;
1422 1421
1423 TabContentsWrapper* tab = GetDisplayedTab(); 1422 TabContents* tab = GetDisplayedTab();
1424 1423
1425 if (tab) 1424 if (tab)
1426 bookmark_bar_->SetPageNavigator(browser_.get()); 1425 bookmark_bar_->SetPageNavigator(browser_.get());
1427 1426
1428 BookmarkBar::State state = browser_->bookmark_bar_state(); 1427 BookmarkBar::State state = browser_->bookmark_bar_state();
1429 if (contents_container_->HasPreview() && state == BookmarkBar::DETACHED) 1428 if (contents_container_->HasPreview() && state == BookmarkBar::DETACHED)
1430 state = BookmarkBar::HIDDEN; 1429 state = BookmarkBar::HIDDEN;
1431 1430
1432 toolbar_->UpdateForBookmarkBarVisibility(state == BookmarkBar::DETACHED); 1431 toolbar_->UpdateForBookmarkBarVisibility(state == BookmarkBar::DETACHED);
1433 PlaceBookmarkBar(state == BookmarkBar::DETACHED); 1432 PlaceBookmarkBar(state == BookmarkBar::DETACHED);
1434 bookmark_bar_->SetBookmarkBarState( 1433 bookmark_bar_->SetBookmarkBarState(
1435 state, 1434 state,
1436 animate ? BookmarkBar::ANIMATE_STATE_CHANGE : 1435 animate ? BookmarkBar::ANIMATE_STATE_CHANGE :
1437 BookmarkBar::DONT_ANIMATE_STATE_CHANGE); 1436 BookmarkBar::DONT_ANIMATE_STATE_CHANGE);
1438 } 1437 }
1439 1438
1440 void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) { 1439 void BrowserWindowGtk::UpdateDevToolsForContents(WebContents* contents) {
1441 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::UpdateDevToolsForContents"); 1440 TRACE_EVENT0("ui::gtk", "BrowserWindowGtk::UpdateDevToolsForContents");
1442 TabContentsWrapper* old_devtools = devtools_container_->tab(); 1441 TabContents* old_devtools = devtools_container_->tab();
1443 TabContentsWrapper* devtools_contents = contents ? 1442 TabContents* devtools_contents = contents ?
1444 DevToolsWindow::GetDevToolsContents(contents) : NULL; 1443 DevToolsWindow::GetDevToolsContents(contents) : NULL;
1445 if (old_devtools == devtools_contents) 1444 if (old_devtools == devtools_contents)
1446 return; 1445 return;
1447 1446
1448 if (old_devtools) 1447 if (old_devtools)
1449 devtools_container_->DetachTab(old_devtools); 1448 devtools_container_->DetachTab(old_devtools);
1450 1449
1451 devtools_container_->SetTab(devtools_contents); 1450 devtools_container_->SetTab(devtools_contents);
1452 if (devtools_contents) { 1451 if (devtools_contents) {
1453 // WebContentsViewGtk::WasShown is not called when tab contents is shown by 1452 // WebContentsViewGtk::WasShown is not called when tab contents is shown by
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 gfx::Rect bounds(event->x, event->y, event->width, event->height); 1532 gfx::Rect bounds(event->x, event->y, event->width, event->height);
1534 1533
1535 // When the window moves, we'll get multiple configure-event signals. We can 1534 // When the window moves, we'll get multiple configure-event signals. We can
1536 // also get events when the bounds haven't changed, but the window's stacking 1535 // also get events when the bounds haven't changed, but the window's stacking
1537 // has, which we aren't interested in. http://crbug.com/70125 1536 // has, which we aren't interested in. http://crbug.com/70125
1538 if (bounds == configure_bounds_) 1537 if (bounds == configure_bounds_)
1539 return FALSE; 1538 return FALSE;
1540 1539
1541 GetLocationBar()->GetLocationEntry()->ClosePopup(); 1540 GetLocationBar()->GetLocationEntry()->ClosePopup();
1542 1541
1543 TabContentsWrapper* tab = GetDisplayedTab(); 1542 TabContents* tab = GetDisplayedTab();
1544 if (tab) { 1543 if (tab) {
1545 tab->web_contents()->GetRenderViewHost()->NotifyMoveOrResizeStarted(); 1544 tab->web_contents()->GetRenderViewHost()->NotifyMoveOrResizeStarted();
1546 } 1545 }
1547 1546
1548 if (bounds_.size() != bounds.size()) 1547 if (bounds_.size() != bounds.size())
1549 OnSizeChanged(bounds.width(), bounds.height()); 1548 OnSizeChanged(bounds.width(), bounds.height());
1550 1549
1551 // We update |bounds_| but not |restored_bounds_| here. The latter needs 1550 // We update |bounds_| but not |restored_bounds_| here. The latter needs
1552 // to be updated conditionally when the window is non-maximized and non- 1551 // to be updated conditionally when the window is non-maximized and non-
1553 // fullscreen, but whether those state updates have been processed yet is 1552 // fullscreen, but whether those state updates have been processed yet is
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1742 // is the case in Valgrind tests). 1741 // is the case in Valgrind tests).
1743 if (ui::XDisplayExists() && 1742 if (ui::XDisplayExists() &&
1744 !prefs->HasPrefPath(prefs::kUseCustomChromeFrame)) { 1743 !prefs->HasPrefPath(prefs::kUseCustomChromeFrame)) {
1745 custom_frame_default = GetCustomFramePrefDefault(); 1744 custom_frame_default = GetCustomFramePrefDefault();
1746 } 1745 }
1747 prefs->RegisterBooleanPref(prefs::kUseCustomChromeFrame, 1746 prefs->RegisterBooleanPref(prefs::kUseCustomChromeFrame,
1748 custom_frame_default, 1747 custom_frame_default,
1749 PrefService::SYNCABLE_PREF); 1748 PrefService::SYNCABLE_PREF);
1750 } 1749 }
1751 1750
1752 TabContentsWrapper* BrowserWindowGtk::GetDisplayedTab() { 1751 TabContents* BrowserWindowGtk::GetDisplayedTab() {
1753 return contents_container_->GetVisibleTab(); 1752 return contents_container_->GetVisibleTab();
1754 } 1753 }
1755 1754
1756 void BrowserWindowGtk::QueueToolbarRedraw() { 1755 void BrowserWindowGtk::QueueToolbarRedraw() {
1757 gtk_widget_queue_draw(toolbar_->widget()); 1756 gtk_widget_queue_draw(toolbar_->widget());
1758 } 1757 }
1759 1758
1760 void BrowserWindowGtk::SetGeometryHints() { 1759 void BrowserWindowGtk::SetGeometryHints() {
1761 // If we call gtk_window_maximize followed by gtk_window_present, compiz gets 1760 // If we call gtk_window_maximize followed by gtk_window_present, compiz gets
1762 // confused and maximizes the window, but doesn't set the 1761 // confused and maximizes the window, but doesn't set the
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 // Let the focused widget have first crack at the key event so we don't 2212 // Let the focused widget have first crack at the key event so we don't
2214 // override their accelerators, except if there is a priority keybinding 2213 // override their accelerators, except if there is a priority keybinding
2215 // handler registered (it should take precedence). 2214 // handler registered (it should take precedence).
2216 gboolean BrowserWindowGtk::OnKeyPress(GtkWidget* widget, GdkEventKey* event) { 2215 gboolean BrowserWindowGtk::OnKeyPress(GtkWidget* widget, GdkEventKey* event) {
2217 if (extension_keybinding_registry_->HasPriorityHandler(event)) 2216 if (extension_keybinding_registry_->HasPriorityHandler(event))
2218 return FALSE; 2217 return FALSE;
2219 2218
2220 // If a widget besides the native view is focused, we have to try to handle 2219 // If a widget besides the native view is focused, we have to try to handle
2221 // the custom accelerators before letting it handle them. 2220 // the custom accelerators before letting it handle them.
2222 WebContents* current_web_contents = 2221 WebContents* current_web_contents =
2223 browser()->GetSelectedWebContents(); 2222 browser()->GetActiveWebContents();
2224 // The current tab might not have a render view if it crashed. 2223 // The current tab might not have a render view if it crashed.
2225 if (!current_web_contents || !current_web_contents->GetContentNativeView() || 2224 if (!current_web_contents || !current_web_contents->GetContentNativeView() ||
2226 !gtk_widget_is_focus(current_web_contents->GetContentNativeView())) { 2225 !gtk_widget_is_focus(current_web_contents->GetContentNativeView())) {
2227 int command_id = GetCustomCommandId(event); 2226 int command_id = GetCustomCommandId(event);
2228 if (command_id == -1) 2227 if (command_id == -1)
2229 command_id = GetPreHandleCommandId(event); 2228 command_id = GetPreHandleCommandId(event);
2230 2229
2231 if (command_id != -1 && browser_->ExecuteCommandIfEnabled(command_id)) 2230 if (command_id != -1 && browser_->ExecuteCommandIfEnabled(command_id))
2232 return TRUE; 2231 return TRUE;
2233 2232
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2602 wm_type == ui::WM_OPENBOX || 2601 wm_type == ui::WM_OPENBOX ||
2603 wm_type == ui::WM_XFWM4); 2602 wm_type == ui::WM_XFWM4);
2604 } 2603 }
2605 2604
2606 // static 2605 // static
2607 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) { 2606 BrowserWindow* BrowserWindow::CreateBrowserWindow(Browser* browser) {
2608 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser); 2607 BrowserWindowGtk* browser_window_gtk = new BrowserWindowGtk(browser);
2609 browser_window_gtk->Init(); 2608 browser_window_gtk->Init();
2610 return browser_window_gtk; 2609 return browser_window_gtk;
2611 } 2610 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/browser_window_gtk.h ('k') | chrome/browser/ui/gtk/collected_cookies_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698