Fixing build: GetViewContainer changed name from under me. :)
[chromium-blink-merge.git] / chrome / browser / external_protocol_handler.h
blob75f3f93e569d2761b269e5db220a4a1f35af6f62
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H__
6 #define CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H__
8 #include "chrome/common/pref_service.h"
10 class GURL;
11 class MessageLoop;
13 class ExternalProtocolHandler {
14 public:
15 enum BlockState {
16 DONT_BLOCK,
17 BLOCK,
18 UNKNOWN,
21 // Returns whether we should block a given scheme.
22 static BlockState GetBlockState(const std::wstring& scheme);
24 // Checks to see if the protocol is allowed, if it is whitelisted,
25 // the application associated with the protocol is launched on the io thread,
26 // if it is blacklisted, returns silently. Otherwise, an
27 // ExternalProtocolDialog is created asking the user. If the user accepts,
28 // LaunchUrlWithoutSecurityCheck is called on the io thread and the
29 // application is launched.
30 // Must run on the UI thread.
31 static void LaunchUrl(const GURL& url, int render_process_host_id,
32 int tab_contents_id);
34 // Register the ExcludedSchemes preference.
35 static void RegisterPrefs(PrefService* prefs);
37 // Starts a url using the external protocol handler with the help
38 // of shellexecute. Should only be called if the protocol is whitelisted
39 // (checked in LaunchUrl) or if the user explicitly allows it. (By selecting
40 // "Launch Application" in an ExternalProtocolDialog.) It is assumed that the
41 // url has already been escaped, which happens in LaunchUrl.
42 // NOTE: You should Not call this function directly unless you are sure the
43 // url you have has been checked against the blacklist, and has been escaped.
44 // All calls to this function should originate in some way from LaunchUrl.
45 // Must run on the IO thread.
46 static void LaunchUrlWithoutSecurityCheck(const GURL& url);
48 // Prepopulates the dictionary with known protocols to deny or allow, if
49 // preferences for them do not already exist.
50 static void PrepopulateDictionary(DictionaryValue* win_pref);
53 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_HANDLER_H__