OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H_ |
6 #define CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H_ | 6 #define CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 class DictionaryValue; | 10 class DictionaryValue; |
11 class GURL; | 11 class GURL; |
12 class MessageLoop; | 12 class MessageLoop; |
13 class PrefService; | 13 class PrefService; |
14 | 14 |
15 class ExternalProtocolHandler { | 15 class ExternalProtocolHandler { |
16 public: | 16 public: |
17 enum BlockState { | 17 enum BlockState { |
18 DONT_BLOCK, | 18 DONT_BLOCK, |
19 BLOCK, | 19 BLOCK, |
20 UNKNOWN, | 20 UNKNOWN, |
21 }; | 21 }; |
22 | 22 |
23 // Returns whether we should block a given scheme. | 23 // Returns whether we should block a given scheme. |
24 static BlockState GetBlockState(const std::wstring& scheme); | 24 static BlockState GetBlockState(const std::wstring& scheme); |
25 | 25 |
| 26 // Sets whether we should block a given scheme. |
| 27 static void SetBlockState(const std::wstring& scheme, BlockState state); |
| 28 |
26 // Checks to see if the protocol is allowed, if it is whitelisted, | 29 // Checks to see if the protocol is allowed, if it is whitelisted, |
27 // the application associated with the protocol is launched on the io thread, | 30 // the application associated with the protocol is launched on the io thread, |
28 // if it is blacklisted, returns silently. Otherwise, an | 31 // if it is blacklisted, returns silently. Otherwise, an |
29 // ExternalProtocolDialog is created asking the user. If the user accepts, | 32 // ExternalProtocolDialog is created asking the user. If the user accepts, |
30 // LaunchUrlWithoutSecurityCheck is called on the io thread and the | 33 // LaunchUrlWithoutSecurityCheck is called on the io thread and the |
31 // application is launched. | 34 // application is launched. |
32 // Must run on the UI thread. | 35 // Must run on the UI thread. |
33 static void LaunchUrl(const GURL& url, int render_process_host_id, | 36 static void LaunchUrl(const GURL& url, int render_process_host_id, |
34 int tab_contents_id); | 37 int tab_contents_id); |
35 | 38 |
(...skipping 27 matching lines...) Expand all Loading... |
63 | 66 |
64 // Prepopulates the dictionary with known protocols to deny or allow, if | 67 // Prepopulates the dictionary with known protocols to deny or allow, if |
65 // preferences for them do not already exist. | 68 // preferences for them do not already exist. |
66 static void PrepopulateDictionary(DictionaryValue* win_pref); | 69 static void PrepopulateDictionary(DictionaryValue* win_pref); |
67 | 70 |
68 // Called when the user interacts with a web page. | 71 // Called when the user interacts with a web page. |
69 static void OnUserGesture(); | 72 static void OnUserGesture(); |
70 }; | 73 }; |
71 | 74 |
72 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H_ | 75 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H_ |
OLD | NEW |