OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ |
6 #define CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ | 6 #define CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "chrome/browser/shell_integration.h" | 10 #include "chrome/browser/shell_integration.h" |
11 | 11 |
12 class GURL; | 12 class GURL; |
13 class PrefService; | 13 class PrefServiceSimple; |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class DictionaryValue; | 16 class DictionaryValue; |
17 } | 17 } |
18 | 18 |
19 class ExternalProtocolHandler { | 19 class ExternalProtocolHandler { |
20 public: | 20 public: |
21 enum BlockState { | 21 enum BlockState { |
22 DONT_BLOCK, | 22 DONT_BLOCK, |
23 BLOCK, | 23 BLOCK, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // NOTE: There is a race between the Time of Check and the Time Of Use for | 71 // NOTE: There is a race between the Time of Check and the Time Of Use for |
72 // the command line. Since the caller (web page) does not have access | 72 // the command line. Since the caller (web page) does not have access |
73 // to change the command line by itself, we do not do anything special | 73 // to change the command line by itself, we do not do anything special |
74 // to protect against this scenario. | 74 // to protect against this scenario. |
75 // This is implemented separately on each platform. | 75 // This is implemented separately on each platform. |
76 static void RunExternalProtocolDialog(const GURL& url, | 76 static void RunExternalProtocolDialog(const GURL& url, |
77 int render_process_host_id, | 77 int render_process_host_id, |
78 int routing_id); | 78 int routing_id); |
79 | 79 |
80 // Register the ExcludedSchemes preference. | 80 // Register the ExcludedSchemes preference. |
81 static void RegisterPrefs(PrefService* prefs); | 81 static void RegisterPrefs(PrefServiceSimple* prefs); |
82 | 82 |
83 // Starts a url using the external protocol handler with the help | 83 // Starts a url using the external protocol handler with the help |
84 // of shellexecute. Should only be called if the protocol is whitelisted | 84 // of shellexecute. Should only be called if the protocol is whitelisted |
85 // (checked in LaunchUrl) or if the user explicitly allows it. (By selecting | 85 // (checked in LaunchUrl) or if the user explicitly allows it. (By selecting |
86 // "Launch Application" in an ExternalProtocolDialog.) It is assumed that the | 86 // "Launch Application" in an ExternalProtocolDialog.) It is assumed that the |
87 // url has already been escaped, which happens in LaunchUrl. | 87 // url has already been escaped, which happens in LaunchUrl. |
88 // NOTE: You should Not call this function directly unless you are sure the | 88 // NOTE: You should Not call this function directly unless you are sure the |
89 // url you have has been checked against the blacklist, and has been escaped. | 89 // url you have has been checked against the blacklist, and has been escaped. |
90 // All calls to this function should originate in some way from LaunchUrl. | 90 // All calls to this function should originate in some way from LaunchUrl. |
91 // This will execute on the file thread. | 91 // This will execute on the file thread. |
92 static void LaunchUrlWithoutSecurityCheck(const GURL& url); | 92 static void LaunchUrlWithoutSecurityCheck(const GURL& url); |
93 | 93 |
94 // Prepopulates the dictionary with known protocols to deny or allow, if | 94 // Prepopulates the dictionary with known protocols to deny or allow, if |
95 // preferences for them do not already exist. | 95 // preferences for them do not already exist. |
96 static void PrepopulateDictionary(base::DictionaryValue* win_pref); | 96 static void PrepopulateDictionary(base::DictionaryValue* win_pref); |
97 | 97 |
98 // Allows LaunchUrl to proceed with launching an external protocol handler. | 98 // Allows LaunchUrl to proceed with launching an external protocol handler. |
99 // This is typically triggered by a user gesture, but is also called for | 99 // This is typically triggered by a user gesture, but is also called for |
100 // each extension API function. Note that each call to LaunchUrl resets | 100 // each extension API function. Note that each call to LaunchUrl resets |
101 // the state to false (not allowed). | 101 // the state to false (not allowed). |
102 static void PermitLaunchUrl(); | 102 static void PermitLaunchUrl(); |
103 }; | 103 }; |
104 | 104 |
105 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ | 105 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ |
OLD | NEW |