| 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/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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 #include "chrome/browser/ui/extensions/hosted_app_browser_controller.h" | 116 #include "chrome/browser/ui/extensions/hosted_app_browser_controller.h" |
| 117 #include "chrome/browser/ui/fast_unload_controller.h" | 117 #include "chrome/browser/ui/fast_unload_controller.h" |
| 118 #include "chrome/browser/ui/find_bar/find_bar.h" | 118 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 119 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 119 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 120 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 120 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 121 #include "chrome/browser/ui/global_error/global_error.h" | 121 #include "chrome/browser/ui/global_error/global_error.h" |
| 122 #include "chrome/browser/ui/global_error/global_error_service.h" | 122 #include "chrome/browser/ui/global_error/global_error_service.h" |
| 123 #include "chrome/browser/ui/global_error/global_error_service_factory.h" | 123 #include "chrome/browser/ui/global_error/global_error_service_factory.h" |
| 124 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h" | 124 #include "chrome/browser/ui/javascript_dialogs/javascript_dialog_tab_helper.h" |
| 125 #include "chrome/browser/ui/location_bar/location_bar.h" | 125 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 126 #include "chrome/browser/ui/media_utils.h" | |
| 127 #include "chrome/browser/ui/search/search_delegate.h" | 126 #include "chrome/browser/ui/search/search_delegate.h" |
| 128 #include "chrome/browser/ui/search/search_model.h" | 127 #include "chrome/browser/ui/search/search_model.h" |
| 129 #include "chrome/browser/ui/search/search_tab_helper.h" | 128 #include "chrome/browser/ui/search/search_tab_helper.h" |
| 130 #include "chrome/browser/ui/settings_window_manager.h" | 129 #include "chrome/browser/ui/settings_window_manager.h" |
| 131 #include "chrome/browser/ui/singleton_tabs.h" | 130 #include "chrome/browser/ui/singleton_tabs.h" |
| 132 #include "chrome/browser/ui/status_bubble.h" | 131 #include "chrome/browser/ui/status_bubble.h" |
| 133 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" | 132 #include "chrome/browser/ui/sync/browser_synced_window_delegate.h" |
| 134 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" | 133 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" |
| 135 #include "chrome/browser/ui/tab_dialogs.h" | 134 #include "chrome/browser/ui/tab_dialogs.h" |
| 136 #include "chrome/browser/ui/tab_helpers.h" | 135 #include "chrome/browser/ui/tab_helpers.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 BrowserWindow* CreateBrowserWindow(Browser* browser) { | 254 BrowserWindow* CreateBrowserWindow(Browser* browser) { |
| 256 return BrowserWindow::CreateBrowserWindow(browser); | 255 return BrowserWindow::CreateBrowserWindow(browser); |
| 257 } | 256 } |
| 258 | 257 |
| 259 // Is the fast tab unload experiment enabled? | 258 // Is the fast tab unload experiment enabled? |
| 260 bool IsFastTabUnloadEnabled() { | 259 bool IsFastTabUnloadEnabled() { |
| 261 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 260 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 262 switches::kEnableFastUnload); | 261 switches::kEnableFastUnload); |
| 263 } | 262 } |
| 264 | 263 |
| 264 const extensions::Extension* GetExtensionForOrigin( |
| 265 Profile* profile, |
| 266 const GURL& security_origin) { |
| 267 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 268 if (!security_origin.SchemeIs(extensions::kExtensionScheme)) |
| 269 return nullptr; |
| 270 |
| 271 const extensions::Extension* extension = |
| 272 extensions::ExtensionRegistry::Get(profile)->enabled_extensions().GetByID( |
| 273 security_origin.host()); |
| 274 DCHECK(extension); |
| 275 return extension; |
| 276 #else |
| 277 return nullptr; |
| 278 #endif |
| 279 } |
| 280 |
| 265 } // namespace | 281 } // namespace |
| 266 | 282 |
| 267 //////////////////////////////////////////////////////////////////////////////// | 283 //////////////////////////////////////////////////////////////////////////////// |
| 268 // Browser, CreateParams: | 284 // Browser, CreateParams: |
| 269 | 285 |
| 270 Browser::CreateParams::CreateParams(Profile* profile) | 286 Browser::CreateParams::CreateParams(Profile* profile) |
| 271 : type(TYPE_TABBED), | 287 : type(TYPE_TABBED), |
| 272 profile(profile), | 288 profile(profile), |
| 273 trusted_source(false), | 289 trusted_source(false), |
| 274 initial_show_state(ui::SHOW_STATE_DEFAULT), | 290 initial_show_state(ui::SHOW_STATE_DEFAULT), |
| (...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 } | 1830 } |
| 1815 | 1831 |
| 1816 void Browser::LostMouseLock() { | 1832 void Browser::LostMouseLock() { |
| 1817 exclusive_access_manager_->mouse_lock_controller()->LostMouseLock(); | 1833 exclusive_access_manager_->mouse_lock_controller()->LostMouseLock(); |
| 1818 } | 1834 } |
| 1819 | 1835 |
| 1820 void Browser::RequestMediaAccessPermission( | 1836 void Browser::RequestMediaAccessPermission( |
| 1821 content::WebContents* web_contents, | 1837 content::WebContents* web_contents, |
| 1822 const content::MediaStreamRequest& request, | 1838 const content::MediaStreamRequest& request, |
| 1823 const content::MediaResponseCallback& callback) { | 1839 const content::MediaResponseCallback& callback) { |
| 1824 ::RequestMediaAccessPermission(web_contents, profile_, request, callback); | 1840 const extensions::Extension* extension = |
| 1841 GetExtensionForOrigin(profile_, request.security_origin); |
| 1842 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( |
| 1843 web_contents, request, callback, extension); |
| 1825 } | 1844 } |
| 1826 | 1845 |
| 1827 bool Browser::CheckMediaAccessPermission(content::WebContents* web_contents, | 1846 bool Browser::CheckMediaAccessPermission(content::WebContents* web_contents, |
| 1828 const GURL& security_origin, | 1847 const GURL& security_origin, |
| 1829 content::MediaStreamType type) { | 1848 content::MediaStreamType type) { |
| 1830 return ::CheckMediaAccessPermission(web_contents, security_origin, type); | 1849 Profile* profile = |
| 1850 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 1851 const extensions::Extension* extension = |
| 1852 GetExtensionForOrigin(profile, security_origin); |
| 1853 return MediaCaptureDevicesDispatcher::GetInstance() |
| 1854 ->CheckMediaAccessPermission(web_contents, security_origin, type, |
| 1855 extension); |
| 1831 } | 1856 } |
| 1832 | 1857 |
| 1833 std::string Browser::GetDefaultMediaDeviceID(content::WebContents* web_contents, | 1858 std::string Browser::GetDefaultMediaDeviceID(content::WebContents* web_contents, |
| 1834 content::MediaStreamType type) { | 1859 content::MediaStreamType type) { |
| 1835 Profile* profile = | 1860 Profile* profile = |
| 1836 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 1861 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 1837 return MediaCaptureDevicesDispatcher::GetInstance() | 1862 return MediaCaptureDevicesDispatcher::GetInstance() |
| 1838 ->GetDefaultDeviceIDForProfile(profile, type); | 1863 ->GetDefaultDeviceIDForProfile(profile, type); |
| 1839 } | 1864 } |
| 1840 | 1865 |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2594 // new window later, thus we need to navigate the window now. | 2619 // new window later, thus we need to navigate the window now. |
| 2595 if (contents) { | 2620 if (contents) { |
| 2596 contents->web_contents()->GetController().LoadURL( | 2621 contents->web_contents()->GetController().LoadURL( |
| 2597 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2622 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
| 2598 std::string()); // No extra headers. | 2623 std::string()); // No extra headers. |
| 2599 } | 2624 } |
| 2600 } | 2625 } |
| 2601 | 2626 |
| 2602 return contents != NULL; | 2627 return contents != NULL; |
| 2603 } | 2628 } |
| OLD | NEW |