Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/external_protocol/external_protocol_handler.h

Issue 2660333004: Revert of Migrate external protocol prefs from local state to profiles (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/macros.h" 10 #include "base/macros.h"
11 #include "chrome/browser/shell_integration.h" 11 #include "chrome/browser/shell_integration.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "ui/base/page_transition_types.h" 13 #include "ui/base/page_transition_types.h"
14 14
15 class GURL; 15 class GURL;
16 class PrefRegistrySimple; 16 class PrefRegistrySimple;
17 class Profile;
18 17
19 namespace base { 18 namespace base {
20 class DictionaryValue; 19 class DictionaryValue;
21 } 20 }
22 21
23 class ExternalProtocolHandler { 22 class ExternalProtocolHandler {
24 public: 23 public:
25 enum BlockState { 24 enum BlockState {
26 DONT_BLOCK, 25 DONT_BLOCK,
27 BLOCK, 26 BLOCK,
28 UNKNOWN, 27 UNKNOWN,
29 }; 28 };
30 29
31 // Delegate to allow unit testing to provide different behavior. 30 // Delegate to allow unit testing to provide different behavior.
32 class Delegate { 31 class Delegate {
33 public: 32 public:
34 virtual scoped_refptr<shell_integration::DefaultProtocolClientWorker> 33 virtual scoped_refptr<shell_integration::DefaultProtocolClientWorker>
35 CreateShellWorker( 34 CreateShellWorker(
36 const shell_integration::DefaultWebClientWorkerCallback& callback, 35 const shell_integration::DefaultWebClientWorkerCallback& callback,
37 const std::string& protocol) = 0; 36 const std::string& protocol) = 0;
38 virtual BlockState GetBlockState(const std::string& scheme, 37 virtual BlockState GetBlockState(const std::string& scheme) = 0;
39 Profile* profile) = 0;
40 virtual void BlockRequest() = 0; 38 virtual void BlockRequest() = 0;
41 virtual void RunExternalProtocolDialog( 39 virtual void RunExternalProtocolDialog(
42 const GURL& url, 40 const GURL& url,
43 int render_process_host_id, 41 int render_process_host_id,
44 int routing_id, 42 int routing_id,
45 ui::PageTransition page_transition, 43 ui::PageTransition page_transition,
46 bool has_user_gesture) = 0; 44 bool has_user_gesture) = 0;
47 virtual void LaunchUrlWithoutSecurityCheck( 45 virtual void LaunchUrlWithoutSecurityCheck(
48 const GURL& url, 46 const GURL& url,
49 content::WebContents* web_contents) = 0; 47 content::WebContents* web_contents) = 0;
50 virtual void FinishedProcessingCheck() = 0; 48 virtual void FinishedProcessingCheck() = 0;
51 virtual ~Delegate() {} 49 virtual ~Delegate() {}
52 }; 50 };
53 51
54 // Returns whether we should block a given scheme. 52 // Returns whether we should block a given scheme.
55 static BlockState GetBlockState(const std::string& scheme, Profile* profile); 53 static BlockState GetBlockState(const std::string& scheme);
56 54
57 // Sets whether we should block a given scheme. 55 // Sets whether we should block a given scheme.
58 static void SetBlockState(const std::string& scheme, 56 static void SetBlockState(const std::string& scheme, BlockState state);
59 BlockState state,
60 Profile* profile);
61 57
62 // Checks to see if the protocol is allowed, if it is whitelisted, 58 // Checks to see if the protocol is allowed, if it is whitelisted,
63 // the application associated with the protocol is launched on the io thread, 59 // the application associated with the protocol is launched on the io thread,
64 // if it is blacklisted, returns silently. Otherwise, an 60 // if it is blacklisted, returns silently. Otherwise, an
65 // ExternalProtocolDialog is created asking the user. If the user accepts, 61 // ExternalProtocolDialog is created asking the user. If the user accepts,
66 // LaunchUrlWithoutSecurityCheck is called on the io thread and the 62 // LaunchUrlWithoutSecurityCheck is called on the io thread and the
67 // application is launched. 63 // application is launched.
68 // Must run on the UI thread. 64 // Must run on the UI thread.
69 // Allowing use of a delegate to facilitate unit testing. 65 // Allowing use of a delegate to facilitate unit testing.
70 static void LaunchUrlWithDelegate(const GURL& url, 66 static void LaunchUrlWithDelegate(const GURL& url,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 int render_process_host_id, 114 int render_process_host_id,
119 int routing_id, 115 int routing_id,
120 ui::PageTransition page_transition, 116 ui::PageTransition page_transition,
121 bool has_user_gesture); 117 bool has_user_gesture);
122 118
123 private: 119 private:
124 DISALLOW_COPY_AND_ASSIGN(ExternalProtocolHandler); 120 DISALLOW_COPY_AND_ASSIGN(ExternalProtocolHandler);
125 }; 121 };
126 122
127 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ 123 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_site_per_process_browsertest.cc ('k') | chrome/browser/external_protocol/external_protocol_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698