OLD | NEW |
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/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 // OS_WIN | 10 #endif // OS_WIN |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 #include "chrome/common/chrome_notification_types.h" | 138 #include "chrome/common/chrome_notification_types.h" |
139 #include "chrome/common/chrome_switches.h" | 139 #include "chrome/common/chrome_switches.h" |
140 #include "chrome/common/custom_handlers/protocol_handler.h" | 140 #include "chrome/common/custom_handlers/protocol_handler.h" |
141 #include "chrome/common/extensions/extension.h" | 141 #include "chrome/common/extensions/extension.h" |
142 #include "chrome/common/extensions/extension_constants.h" | 142 #include "chrome/common/extensions/extension_constants.h" |
143 #include "chrome/common/pref_names.h" | 143 #include "chrome/common/pref_names.h" |
144 #include "chrome/common/profiling.h" | 144 #include "chrome/common/profiling.h" |
145 #include "chrome/common/url_constants.h" | 145 #include "chrome/common/url_constants.h" |
146 #include "chrome/common/web_apps.h" | 146 #include "chrome/common/web_apps.h" |
147 #include "content/browser/browser_url_handler.h" | 147 #include "content/browser/browser_url_handler.h" |
148 #include "content/browser/child_process_security_policy.h" | |
149 #include "content/browser/renderer_host/render_view_host.h" | 148 #include "content/browser/renderer_host/render_view_host.h" |
150 #include "content/browser/tab_contents/interstitial_page.h" | 149 #include "content/browser/tab_contents/interstitial_page.h" |
151 #include "content/public/browser/devtools_manager.h" | 150 #include "content/public/browser/devtools_manager.h" |
152 #include "content/public/browser/download_item.h" | 151 #include "content/public/browser/download_item.h" |
153 #include "content/public/browser/download_manager.h" | 152 #include "content/public/browser/download_manager.h" |
154 #include "content/public/browser/invalidate_type.h" | 153 #include "content/public/browser/invalidate_type.h" |
155 #include "content/public/browser/navigation_controller.h" | 154 #include "content/public/browser/navigation_controller.h" |
156 #include "content/public/browser/navigation_entry.h" | 155 #include "content/public/browser/navigation_entry.h" |
157 #include "content/public/browser/notification_details.h" | 156 #include "content/public/browser/notification_details.h" |
158 #include "content/public/browser/notification_service.h" | 157 #include "content/public/browser/notification_service.h" |
(...skipping 2467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2626 // sending the result message. It won't be destroyed when this reference | 2625 // sending the result message. It won't be destroyed when this reference |
2627 // goes out of scope. | 2626 // goes out of scope. |
2628 scoped_refptr<FileSelectHelper> file_select_helper( | 2627 scoped_refptr<FileSelectHelper> file_select_helper( |
2629 new FileSelectHelper(profile)); | 2628 new FileSelectHelper(profile)); |
2630 file_select_helper->RunFileChooser(tab->GetRenderViewHost(), tab, params); | 2629 file_select_helper->RunFileChooser(tab->GetRenderViewHost(), tab, params); |
2631 } | 2630 } |
2632 | 2631 |
2633 // static | 2632 // static |
2634 void Browser::EnumerateDirectoryHelper(WebContents* tab, int request_id, | 2633 void Browser::EnumerateDirectoryHelper(WebContents* tab, int request_id, |
2635 const FilePath& path) { | 2634 const FilePath& path) { |
2636 ChildProcessSecurityPolicy* policy = | |
2637 ChildProcessSecurityPolicy::GetInstance(); | |
2638 if (!policy->CanReadDirectory(tab->GetRenderProcessHost()->GetID(), path)) | |
2639 return; | |
2640 | |
2641 Profile* profile = | 2635 Profile* profile = |
2642 Profile::FromBrowserContext(tab->GetBrowserContext()); | 2636 Profile::FromBrowserContext(tab->GetBrowserContext()); |
2643 // FileSelectHelper adds a reference to itself and only releases it after | 2637 // FileSelectHelper adds a reference to itself and only releases it after |
2644 // sending the result message. It won't be destroyed when this reference | 2638 // sending the result message. It won't be destroyed when this reference |
2645 // goes out of scope. | 2639 // goes out of scope. |
2646 scoped_refptr<FileSelectHelper> file_select_helper( | 2640 scoped_refptr<FileSelectHelper> file_select_helper( |
2647 new FileSelectHelper(profile)); | 2641 new FileSelectHelper(profile)); |
2648 file_select_helper->EnumerateDirectory(request_id, | 2642 file_select_helper->EnumerateDirectory(request_id, |
2649 tab->GetRenderViewHost(), | 2643 tab->GetRenderViewHost(), |
2650 path); | 2644 path); |
(...skipping 17 matching lines...) Expand all Loading... |
2668 // static | 2662 // static |
2669 void Browser::RegisterProtocolHandlerHelper(WebContents* tab, | 2663 void Browser::RegisterProtocolHandlerHelper(WebContents* tab, |
2670 const std::string& protocol, | 2664 const std::string& protocol, |
2671 const GURL& url, | 2665 const GURL& url, |
2672 const string16& title) { | 2666 const string16& title) { |
2673 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( | 2667 TabContentsWrapper* tcw = TabContentsWrapper::GetCurrentWrapperForContents( |
2674 tab); | 2668 tab); |
2675 if (!tcw || tcw->profile()->IsOffTheRecord()) | 2669 if (!tcw || tcw->profile()->IsOffTheRecord()) |
2676 return; | 2670 return; |
2677 | 2671 |
2678 ChildProcessSecurityPolicy* policy = | |
2679 ChildProcessSecurityPolicy::GetInstance(); | |
2680 if (policy->IsPseudoScheme(protocol) || policy->IsDisabledScheme(protocol)) | |
2681 return; | |
2682 | |
2683 ProtocolHandler handler = | 2672 ProtocolHandler handler = |
2684 ProtocolHandler::CreateProtocolHandler(protocol, url, title); | 2673 ProtocolHandler::CreateProtocolHandler(protocol, url, title); |
2685 | 2674 |
2686 ProtocolHandlerRegistry* registry = | 2675 ProtocolHandlerRegistry* registry = |
2687 tcw->profile()->GetProtocolHandlerRegistry(); | 2676 tcw->profile()->GetProtocolHandlerRegistry(); |
2688 | 2677 |
2689 if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) { | 2678 if (!registry->SilentlyHandleRegisterHandlerRequest(handler)) { |
2690 content::RecordAction( | 2679 content::RecordAction( |
2691 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown")); | 2680 UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown")); |
2692 InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); | 2681 InfoBarTabHelper* infobar_helper = tcw->infobar_tab_helper(); |
(...skipping 2813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5506 profile()->GetOriginalProfile()); | 5495 profile()->GetOriginalProfile()); |
5507 if (service->HasSyncSetupCompleted()) | 5496 if (service->HasSyncSetupCompleted()) |
5508 ShowOptionsTab(chrome::kPersonalOptionsSubPage); | 5497 ShowOptionsTab(chrome::kPersonalOptionsSubPage); |
5509 else | 5498 else |
5510 service->ShowLoginDialog(); | 5499 service->ShowLoginDialog(); |
5511 } | 5500 } |
5512 | 5501 |
5513 void Browser::ToggleSpeechInput() { | 5502 void Browser::ToggleSpeechInput() { |
5514 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); | 5503 GetSelectedWebContents()->GetRenderViewHost()->ToggleSpeechInput(); |
5515 } | 5504 } |
OLD | NEW |