Chromium Code Reviews| 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 #if BUILDFLAG(ENABLE_EXTENSIONS) | |
|
Peter Kasting
2017/01/24 00:26:41
Nit: If you do this instead:
const extensions::Ex
Guido Urdaneta
2017/01/24 10:45:39
Done.
| |
| 265 const extensions::Extension* GetExtensionForOrigin( | |
| 266 Profile* profile, | |
| 267 const GURL& security_origin) { | |
| 268 if (!security_origin.SchemeIs(extensions::kExtensionScheme)) | |
| 269 return NULL; | |
|
Peter Kasting
2017/01/24 00:26:42
Nit: nullptr
Guido Urdaneta
2017/01/24 10:45:39
Done.
| |
| 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 } | |
| 277 #endif | |
| 278 | |
| 265 } // namespace | 279 } // namespace |
| 266 | 280 |
| 267 //////////////////////////////////////////////////////////////////////////////// | 281 //////////////////////////////////////////////////////////////////////////////// |
| 268 // Browser, CreateParams: | 282 // Browser, CreateParams: |
| 269 | 283 |
| 270 Browser::CreateParams::CreateParams(Profile* profile) | 284 Browser::CreateParams::CreateParams(Profile* profile) |
| 271 : type(TYPE_TABBED), | 285 : type(TYPE_TABBED), |
| 272 profile(profile), | 286 profile(profile), |
| 273 trusted_source(false), | 287 trusted_source(false), |
| 274 initial_show_state(ui::SHOW_STATE_DEFAULT), | 288 initial_show_state(ui::SHOW_STATE_DEFAULT), |
| (...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1809 } | 1823 } |
| 1810 | 1824 |
| 1811 void Browser::LostMouseLock() { | 1825 void Browser::LostMouseLock() { |
| 1812 exclusive_access_manager_->mouse_lock_controller()->LostMouseLock(); | 1826 exclusive_access_manager_->mouse_lock_controller()->LostMouseLock(); |
| 1813 } | 1827 } |
| 1814 | 1828 |
| 1815 void Browser::RequestMediaAccessPermission( | 1829 void Browser::RequestMediaAccessPermission( |
| 1816 content::WebContents* web_contents, | 1830 content::WebContents* web_contents, |
| 1817 const content::MediaStreamRequest& request, | 1831 const content::MediaStreamRequest& request, |
| 1818 const content::MediaResponseCallback& callback) { | 1832 const content::MediaResponseCallback& callback) { |
| 1819 ::RequestMediaAccessPermission(web_contents, profile_, request, callback); | 1833 const extensions::Extension* extension = NULL; |
|
Peter Kasting
2017/01/24 00:26:41
Nit: Can be combined with the next line if you fol
Guido Urdaneta
2017/01/24 10:45:39
Done.
| |
| 1834 #if BUILDFLAG(ENABLE_EXTENSIONS) | |
| 1835 extension = GetExtensionForOrigin(profile_, request.security_origin); | |
| 1836 #endif | |
| 1837 MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest( | |
| 1838 web_contents, request, callback, extension); | |
| 1820 } | 1839 } |
| 1821 | 1840 |
| 1822 bool Browser::CheckMediaAccessPermission(content::WebContents* web_contents, | 1841 bool Browser::CheckMediaAccessPermission(content::WebContents* web_contents, |
| 1823 const GURL& security_origin, | 1842 const GURL& security_origin, |
| 1824 content::MediaStreamType type) { | 1843 content::MediaStreamType type) { |
| 1825 return ::CheckMediaAccessPermission(web_contents, security_origin, type); | 1844 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 1845 Profile* profile = | |
| 1846 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | |
| 1847 const extensions::Extension* extension = | |
| 1848 GetExtensionForOrigin(profile, security_origin); | |
| 1849 if (extension) { | |
| 1850 return MediaCaptureDevicesDispatcher::GetInstance() | |
| 1851 ->CheckMediaAccessPermission(web_contents, security_origin, type, | |
| 1852 extension); | |
| 1853 } | |
| 1854 return MediaCaptureDevicesDispatcher::GetInstance() | |
| 1855 ->CheckMediaAccessPermission(web_contents, security_origin, type); | |
|
Peter Kasting
2017/01/24 00:26:41
Nit: Since the four-arg version of CheckMediaAcces
Guido Urdaneta
2017/01/24 10:45:39
Done.
| |
| 1856 #else | |
| 1857 return MediaCaptureDevicesDispatcher::GetInstance() | |
| 1858 ->CheckMediaAccessPermission(web_contents, security_origin, type); | |
| 1859 #endif | |
| 1826 } | 1860 } |
| 1827 | 1861 |
| 1828 std::string Browser::GetDefaultMediaDeviceId(content::WebContents* web_contents, | 1862 std::string Browser::GetDefaultMediaDeviceId(content::WebContents* web_contents, |
| 1829 content::MediaStreamType type) { | 1863 content::MediaStreamType type) { |
| 1830 Profile* profile = | 1864 Profile* profile = |
| 1831 Profile::FromBrowserContext(web_contents->GetBrowserContext()); | 1865 Profile::FromBrowserContext(web_contents->GetBrowserContext()); |
| 1832 return MediaCaptureDevicesDispatcher::GetInstance() | 1866 return MediaCaptureDevicesDispatcher::GetInstance() |
| 1833 ->GetDefaultDeviceIdForProfile(profile, type); | 1867 ->GetDefaultDeviceIdForProfile(profile, type); |
| 1834 } | 1868 } |
| 1835 | 1869 |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2589 // new window later, thus we need to navigate the window now. | 2623 // new window later, thus we need to navigate the window now. |
| 2590 if (contents) { | 2624 if (contents) { |
| 2591 contents->web_contents()->GetController().LoadURL( | 2625 contents->web_contents()->GetController().LoadURL( |
| 2592 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, | 2626 target_url, content::Referrer(), ui::PAGE_TRANSITION_LINK, |
| 2593 std::string()); // No extra headers. | 2627 std::string()); // No extra headers. |
| 2594 } | 2628 } |
| 2595 } | 2629 } |
| 2596 | 2630 |
| 2597 return contents != NULL; | 2631 return contents != NULL; |
| 2598 } | 2632 } |
| OLD | NEW |