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

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

Issue 1251633002: Add BubbleManager to manage bubbles and ChromeBubbleManager for events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac Changes to test trybots Created 5 years, 4 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
OLDNEW
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/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 } 802 }
803 803
804 //////////////////////////////////////////////////////////////////////////////// 804 ////////////////////////////////////////////////////////////////////////////////
805 // Browser, Tab adding/showing functions: 805 // Browser, Tab adding/showing functions:
806 806
807 void Browser::WindowFullscreenStateChanged() { 807 void Browser::WindowFullscreenStateChanged() {
808 exclusive_access_manager_->fullscreen_controller() 808 exclusive_access_manager_->fullscreen_controller()
809 ->WindowFullscreenStateChanged(); 809 ->WindowFullscreenStateChanged();
810 command_controller_->FullscreenStateChanged(); 810 command_controller_->FullscreenStateChanged();
811 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN); 811 UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TOGGLE_FULLSCREEN);
812
813 bubble_manager_.FullscreenToggle();
msw 2015/08/18 17:26:18 nit: name this WindowFullscreenStateChanged for co
msw 2015/08/18 17:26:18 It'd be nice if this didn't have to be hooked dire
hcarmona 2015/08/18 23:08:47 Acknowledged.
hcarmona 2015/08/18 23:08:47 Done.
812 } 814 }
813 815
814 /////////////////////////////////////////////////////////////////////////////// 816 ///////////////////////////////////////////////////////////////////////////////
815 // Browser, Assorted browser commands: 817 // Browser, Assorted browser commands:
816 818
817 void Browser::ToggleFullscreenModeWithExtension(const GURL& extension_url) { 819 void Browser::ToggleFullscreenModeWithExtension(const GURL& extension_url) {
818 exclusive_access_manager_->fullscreen_controller() 820 exclusive_access_manager_->fullscreen_controller()
819 ->ToggleBrowserFullscreenModeWithExtension(extension_url); 821 ->ToggleBrowserFullscreenModeWithExtension(extension_url);
820 } 822 }
821 823
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 int old_active_index = tab_strip_model_->active_index(); 985 int old_active_index = tab_strip_model_->active_index();
984 if (index < old_active_index && !tab_strip_model_->closing_all()) { 986 if (index < old_active_index && !tab_strip_model_->closing_all()) {
985 SessionService* session_service = 987 SessionService* session_service =
986 SessionServiceFactory::GetForProfileIfExisting(profile_); 988 SessionServiceFactory::GetForProfileIfExisting(profile_);
987 if (session_service) 989 if (session_service)
988 session_service->SetSelectedTabInWindow(session_id(), 990 session_service->SetSelectedTabInWindow(session_id(),
989 old_active_index - 1); 991 old_active_index - 1);
990 } 992 }
991 993
992 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH); 994 TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH);
995
996 bubble_manager_.TabDetached();
msw 2015/08/18 17:26:18 Instead of adding logic here, can the ChromeBubble
hcarmona 2015/08/18 23:08:47 Making it into a TabStipModelObserver seems like o
msw 2015/08/19 00:18:11 I don't think it's overkill, especially when it re
groby-ooo-7-16 2015/08/19 00:52:01 +1 on that. browser.cc is currently some catch-all
993 } 997 }
994 998
995 void Browser::TabDeactivated(WebContents* contents) { 999 void Browser::TabDeactivated(WebContents* contents) {
996 exclusive_access_manager_->OnTabDeactivated(contents); 1000 exclusive_access_manager_->OnTabDeactivated(contents);
997 search_delegate_->OnTabDeactivated(contents); 1001 search_delegate_->OnTabDeactivated(contents);
998 SearchTabHelper::FromWebContents(contents)->OnTabDeactivated(); 1002 SearchTabHelper::FromWebContents(contents)->OnTabDeactivated();
999 1003
1000 // Save what the user's currently typing, so it can be restored when we 1004 // Save what the user's currently typing, so it can be restored when we
1001 // switch back to this tab. 1005 // switch back to this tab.
1002 window_->GetLocationBar()->SaveStateToContents(contents); 1006 window_->GetLocationBar()->SaveStateToContents(contents);
1003 1007
1004 if (instant_controller_) 1008 if (instant_controller_)
1005 instant_controller_->TabDeactivated(contents); 1009 instant_controller_->TabDeactivated(contents);
1010
1011 bubble_manager_.TabBlur();
msw 2015/08/18 17:26:18 Ditto, make ChromeBubbleManager a TabStripModelObs
hcarmona 2015/08/18 23:08:47 Acknowledged.
1006 } 1012 }
1007 1013
1008 void Browser::ActiveTabChanged(WebContents* old_contents, 1014 void Browser::ActiveTabChanged(WebContents* old_contents,
1009 WebContents* new_contents, 1015 WebContents* new_contents,
1010 int index, 1016 int index,
1011 int reason) { 1017 int reason) {
1012 content::RecordAction(UserMetricsAction("ActiveTabChanged")); 1018 content::RecordAction(UserMetricsAction("ActiveTabChanged"));
1013 1019
1014 // Update the bookmark state, since the BrowserWindow may query it during 1020 // Update the bookmark state, since the BrowserWindow may query it during
1015 // OnActiveTabChanged() below. 1021 // OnActiveTabChanged() below.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 base::TimeTicks::Now()); 1086 base::TimeTicks::Now());
1081 } 1087 }
1082 } 1088 }
1083 1089
1084 // This needs to be called after notifying SearchDelegate. 1090 // This needs to be called after notifying SearchDelegate.
1085 if (instant_controller_) 1091 if (instant_controller_)
1086 instant_controller_->ActiveTabChanged(); 1092 instant_controller_->ActiveTabChanged();
1087 1093
1088 autofill::ChromeAutofillClient::FromWebContents(new_contents)->TabActivated(); 1094 autofill::ChromeAutofillClient::FromWebContents(new_contents)->TabActivated();
1089 SearchTabHelper::FromWebContents(new_contents)->OnTabActivated(); 1095 SearchTabHelper::FromWebContents(new_contents)->OnTabActivated();
1096
1097 bubble_manager_.TabFocus();
msw 2015/08/18 17:26:18 Ditto, make ChromeBubbleManager a TabStripModelObs
hcarmona 2015/08/18 23:08:47 This function's not needed.
1090 } 1098 }
1091 1099
1092 void Browser::TabMoved(WebContents* contents, 1100 void Browser::TabMoved(WebContents* contents,
1093 int from_index, 1101 int from_index,
1094 int to_index) { 1102 int to_index) {
1095 DCHECK(from_index >= 0 && to_index >= 0); 1103 DCHECK(from_index >= 0 && to_index >= 0);
1096 // Notify the history service. 1104 // Notify the history service.
1097 SyncHistoryWithTabs(std::min(from_index, to_index)); 1105 SyncHistoryWithTabs(std::min(from_index, to_index));
1098 } 1106 }
1099 1107
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 if (contents && !allow_js_access) { 2664 if (contents && !allow_js_access) {
2657 contents->web_contents()->GetController().LoadURL( 2665 contents->web_contents()->GetController().LoadURL(
2658 target_url, 2666 target_url,
2659 content::Referrer(), 2667 content::Referrer(),
2660 ui::PAGE_TRANSITION_LINK, 2668 ui::PAGE_TRANSITION_LINK,
2661 std::string()); // No extra headers. 2669 std::string()); // No extra headers.
2662 } 2670 }
2663 2671
2664 return contents != NULL; 2672 return contents != NULL;
2665 } 2673 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698