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

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

Issue 2623033006: [Re-landing] Migrate external protocol prefs from local state to profiles (Closed)
Patch Set: rebase 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;
17 18
18 namespace base { 19 namespace base {
19 class DictionaryValue; 20 class DictionaryValue;
20 } 21 }
21 22
22 class ExternalProtocolHandler { 23 class ExternalProtocolHandler {
23 public: 24 public:
24 enum BlockState { 25 enum BlockState {
25 DONT_BLOCK, 26 DONT_BLOCK,
26 BLOCK, 27 BLOCK,
27 UNKNOWN, 28 UNKNOWN,
28 }; 29 };
29 30
30 // Delegate to allow unit testing to provide different behavior. 31 // Delegate to allow unit testing to provide different behavior.
31 class Delegate { 32 class Delegate {
32 public: 33 public:
33 virtual scoped_refptr<shell_integration::DefaultProtocolClientWorker> 34 virtual scoped_refptr<shell_integration::DefaultProtocolClientWorker>
34 CreateShellWorker( 35 CreateShellWorker(
35 const shell_integration::DefaultWebClientWorkerCallback& callback, 36 const shell_integration::DefaultWebClientWorkerCallback& callback,
36 const std::string& protocol) = 0; 37 const std::string& protocol) = 0;
37 virtual BlockState GetBlockState(const std::string& scheme) = 0; 38 virtual BlockState GetBlockState(const std::string& scheme,
39 Profile* profile) = 0;
38 virtual void BlockRequest() = 0; 40 virtual void BlockRequest() = 0;
39 virtual void RunExternalProtocolDialog( 41 virtual void RunExternalProtocolDialog(
40 const GURL& url, 42 const GURL& url,
41 int render_process_host_id, 43 int render_process_host_id,
42 int routing_id, 44 int routing_id,
43 ui::PageTransition page_transition, 45 ui::PageTransition page_transition,
44 bool has_user_gesture) = 0; 46 bool has_user_gesture) = 0;
45 virtual void LaunchUrlWithoutSecurityCheck( 47 virtual void LaunchUrlWithoutSecurityCheck(
46 const GURL& url, 48 const GURL& url,
47 content::WebContents* web_contents) = 0; 49 content::WebContents* web_contents) = 0;
48 virtual void FinishedProcessingCheck() = 0; 50 virtual void FinishedProcessingCheck() = 0;
49 virtual ~Delegate() {} 51 virtual ~Delegate() {}
50 }; 52 };
51 53
52 // Returns whether we should block a given scheme. 54 // Returns whether we should block a given scheme.
53 static BlockState GetBlockState(const std::string& scheme); 55 static BlockState GetBlockState(const std::string& scheme, Profile* profile);
54 56
55 // Sets whether we should block a given scheme. 57 // Sets whether we should block a given scheme.
56 static void SetBlockState(const std::string& scheme, BlockState state); 58 static void SetBlockState(const std::string& scheme,
59 BlockState state,
60 Profile* profile);
57 61
58 // Checks to see if the protocol is allowed, if it is whitelisted, 62 // Checks to see if the protocol is allowed, if it is whitelisted,
59 // the application associated with the protocol is launched on the io thread, 63 // the application associated with the protocol is launched on the io thread,
60 // if it is blacklisted, returns silently. Otherwise, an 64 // if it is blacklisted, returns silently. Otherwise, an
61 // ExternalProtocolDialog is created asking the user. If the user accepts, 65 // ExternalProtocolDialog is created asking the user. If the user accepts,
62 // LaunchUrlWithoutSecurityCheck is called on the io thread and the 66 // LaunchUrlWithoutSecurityCheck is called on the io thread and the
63 // application is launched. 67 // application is launched.
64 // Must run on the UI thread. 68 // Must run on the UI thread.
65 // Allowing use of a delegate to facilitate unit testing. 69 // Allowing use of a delegate to facilitate unit testing.
66 static void LaunchUrlWithDelegate(const GURL& url, 70 static void LaunchUrlWithDelegate(const GURL& url,
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 int render_process_host_id, 118 int render_process_host_id,
115 int routing_id, 119 int routing_id,
116 ui::PageTransition page_transition, 120 ui::PageTransition page_transition,
117 bool has_user_gesture); 121 bool has_user_gesture);
118 122
119 private: 123 private:
120 DISALLOW_COPY_AND_ASSIGN(ExternalProtocolHandler); 124 DISALLOW_COPY_AND_ASSIGN(ExternalProtocolHandler);
121 }; 125 };
122 126
123 #endif // CHROME_BROWSER_EXTERNAL_PROTOCOL_EXTERNAL_PROTOCOL_HANDLER_H_ 127 #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