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

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

Issue 1984923002: Refactor ChooserBubbleController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 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
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 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #include "chrome/browser/sync/profile_sync_service_factory.h" 84 #include "chrome/browser/sync/profile_sync_service_factory.h"
85 #include "chrome/browser/sync/sync_ui_util.h" 85 #include "chrome/browser/sync/sync_ui_util.h"
86 #include "chrome/browser/tab_contents/retargeting_details.h" 86 #include "chrome/browser/tab_contents/retargeting_details.h"
87 #include "chrome/browser/tab_contents/tab_util.h" 87 #include "chrome/browser/tab_contents/tab_util.h"
88 #include "chrome/browser/task_management/web_contents_tags.h" 88 #include "chrome/browser/task_management/web_contents_tags.h"
89 #include "chrome/browser/themes/theme_service.h" 89 #include "chrome/browser/themes/theme_service.h"
90 #include "chrome/browser/themes/theme_service_factory.h" 90 #include "chrome/browser/themes/theme_service_factory.h"
91 #include "chrome/browser/translate/chrome_translate_client.h" 91 #include "chrome/browser/translate/chrome_translate_client.h"
92 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" 92 #include "chrome/browser/ui/autofill/chrome_autofill_client.h"
93 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h" 93 #include "chrome/browser/ui/blocked_content/popup_blocker_tab_helper.h"
94 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_bubble_controller.h" 94 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_controller.h"
95 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h" 95 #include "chrome/browser/ui/bluetooth/bluetooth_chooser_desktop.h"
96 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" 96 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h"
97 #include "chrome/browser/ui/bookmarks/bookmark_utils.h" 97 #include "chrome/browser/ui/bookmarks/bookmark_utils.h"
98 #include "chrome/browser/ui/browser_command_controller.h" 98 #include "chrome/browser/ui/browser_command_controller.h"
99 #include "chrome/browser/ui/browser_commands.h" 99 #include "chrome/browser/ui/browser_commands.h"
100 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" 100 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
101 #include "chrome/browser/ui/browser_dialogs.h" 101 #include "chrome/browser/ui/browser_dialogs.h"
102 #include "chrome/browser/ui/browser_finder.h" 102 #include "chrome/browser/ui/browser_finder.h"
103 #include "chrome/browser/ui/browser_instant_controller.h" 103 #include "chrome/browser/ui/browser_instant_controller.h"
104 #include "chrome/browser/ui/browser_list.h" 104 #include "chrome/browser/ui/browser_list.h"
(...skipping 30 matching lines...) Expand all
135 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 135 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
136 #include "chrome/browser/ui/tab_dialogs.h" 136 #include "chrome/browser/ui/tab_dialogs.h"
137 #include "chrome/browser/ui/tab_helpers.h" 137 #include "chrome/browser/ui/tab_helpers.h"
138 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" 138 #include "chrome/browser/ui/tab_modal_confirm_dialog.h"
139 #include "chrome/browser/ui/tabs/tab_menu_model.h" 139 #include "chrome/browser/ui/tabs/tab_menu_model.h"
140 #include "chrome/browser/ui/tabs/tab_strip_model.h" 140 #include "chrome/browser/ui/tabs/tab_strip_model.h"
141 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" 141 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h"
142 #include "chrome/browser/ui/tabs/tab_utils.h" 142 #include "chrome/browser/ui/tabs/tab_utils.h"
143 #include "chrome/browser/ui/unload_controller.h" 143 #include "chrome/browser/ui/unload_controller.h"
144 #include "chrome/browser/ui/validation_message_bubble.h" 144 #include "chrome/browser/ui/validation_message_bubble.h"
145 #include "chrome/browser/ui/website_settings/chooser_bubble_delegate.h"
145 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 146 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
146 #include "chrome/browser/ui/webui/signin/login_ui_service.h" 147 #include "chrome/browser/ui/webui/signin/login_ui_service.h"
147 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" 148 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h"
148 #include "chrome/browser/ui/window_sizer/window_sizer.h" 149 #include "chrome/browser/ui/window_sizer/window_sizer.h"
149 #include "chrome/browser/upgrade_detector.h" 150 #include "chrome/browser/upgrade_detector.h"
150 #include "chrome/common/chrome_constants.h" 151 #include "chrome/common/chrome_constants.h"
151 #include "chrome/common/chrome_switches.h" 152 #include "chrome/common/chrome_switches.h"
152 #include "chrome/common/custom_handlers/protocol_handler.h" 153 #include "chrome/common/custom_handlers/protocol_handler.h"
153 #include "chrome/common/pref_names.h" 154 #include "chrome/common/pref_names.h"
154 #include "chrome/common/profiling.h" 155 #include "chrome/common/profiling.h"
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1317 content::WebContents* web_contents, int cert_id) { 1318 content::WebContents* web_contents, int cert_id) {
1318 DevToolsWindow* devtools_window = 1319 DevToolsWindow* devtools_window =
1319 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents); 1320 DevToolsWindow::GetInstanceForInspectedWebContents(web_contents);
1320 if (devtools_window) 1321 if (devtools_window)
1321 devtools_window->ShowCertificateViewer(cert_id); 1322 devtools_window->ShowCertificateViewer(cert_id);
1322 } 1323 }
1323 1324
1324 std::unique_ptr<content::BluetoothChooser> Browser::RunBluetoothChooser( 1325 std::unique_ptr<content::BluetoothChooser> Browser::RunBluetoothChooser(
1325 content::RenderFrameHost* frame, 1326 content::RenderFrameHost* frame,
1326 const content::BluetoothChooser::EventHandler& event_handler) { 1327 const content::BluetoothChooser::EventHandler& event_handler) {
1328 std::unique_ptr<BluetoothChooserController> bluetooth_chooser_controller(
1329 new BluetoothChooserController(frame, event_handler));
1330
1327 std::unique_ptr<BluetoothChooserDesktop> bluetooth_chooser_desktop( 1331 std::unique_ptr<BluetoothChooserDesktop> bluetooth_chooser_desktop(
1328 new BluetoothChooserDesktop(event_handler)); 1332 new BluetoothChooserDesktop(bluetooth_chooser_controller.get()));
1329 std::unique_ptr<BluetoothChooserBubbleController> bubble_controller(
1330 new BluetoothChooserBubbleController(frame));
1331 BluetoothChooserBubbleController* bubble_controller_ptr =
1332 bubble_controller.get();
1333 1333
1334 // Wire the ChooserBubbleController to the BluetoothChooser. 1334 std::unique_ptr<ChooserBubbleDelegate> chooser_bubble_delegate(
1335 bluetooth_chooser_desktop->set_bluetooth_chooser_bubble_controller( 1335 new ChooserBubbleDelegate(frame,
1336 bubble_controller_ptr); 1336 std::move(bluetooth_chooser_controller)));
1337 bubble_controller->set_bluetooth_chooser(bluetooth_chooser_desktop.get());
1338 1337
1339 Browser* browser = chrome::FindBrowserWithWebContents( 1338 Browser* browser = chrome::FindBrowserWithWebContents(
1340 WebContents::FromRenderFrameHost(frame)); 1339 WebContents::FromRenderFrameHost(frame));
1341 BubbleReference bubble_reference = 1340 BubbleReference bubble_reference = browser->GetBubbleManager()->ShowBubble(
1342 browser->GetBubbleManager()->ShowBubble(std::move(bubble_controller)); 1341 std::move(chooser_bubble_delegate));
1343 bubble_controller_ptr->set_bubble_reference(bubble_reference);
1344 1342
1345 return std::move(bluetooth_chooser_desktop); 1343 return std::move(bluetooth_chooser_desktop);
1346 } 1344 }
1347 1345
1348 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) { 1346 void Browser::RequestAppBannerFromDevTools(content::WebContents* web_contents) {
1349 banners::AppBannerManagerEmulation::CreateForWebContents(web_contents); 1347 banners::AppBannerManagerEmulation::CreateForWebContents(web_contents);
1350 banners::AppBannerManagerEmulation* manager = 1348 banners::AppBannerManagerEmulation* manager =
1351 banners::AppBannerManagerEmulation::FromWebContents(web_contents); 1349 banners::AppBannerManagerEmulation::FromWebContents(web_contents);
1352 manager->RequestAppBanner(web_contents->GetMainFrame(), 1350 manager->RequestAppBanner(web_contents->GetMainFrame(),
1353 web_contents->GetLastCommittedURL(), true); 1351 web_contents->GetLastCommittedURL(), true);
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after
2601 if (contents && !allow_js_access) { 2599 if (contents && !allow_js_access) {
2602 contents->web_contents()->GetController().LoadURL( 2600 contents->web_contents()->GetController().LoadURL(
2603 target_url, 2601 target_url,
2604 content::Referrer(), 2602 content::Referrer(),
2605 ui::PAGE_TRANSITION_LINK, 2603 ui::PAGE_TRANSITION_LINK,
2606 std::string()); // No extra headers. 2604 std::string()); // No extra headers.
2607 } 2605 }
2608 2606
2609 return contents != NULL; 2607 return contents != NULL;
2610 } 2608 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698