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

Side by Side Diff: chrome/browser/extensions/api/messaging/native_message_process_host.h

Issue 118253005: Add managed policies for Native Messaging (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/process/process.h" 14 #include "base/process/process.h"
15 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h" 15 #include "chrome/browser/extensions/api/messaging/native_process_launcher.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 18
19 class PrefService;
20
19 namespace net { 21 namespace net {
20 22
21 class DrainableIOBuffer; 23 class DrainableIOBuffer;
22 class FileStream; 24 class FileStream;
23 class IOBuffer; 25 class IOBuffer;
24 class IOBufferWithSize; 26 class IOBufferWithSize;
25 27
26 } // namespace net 28 } // namespace net
27 29
28 namespace extensions { 30 namespace extensions {
(...skipping 16 matching lines...) Expand all
45 virtual ~Client() {} 47 virtual ~Client() {}
46 // Called on the UI thread. 48 // Called on the UI thread.
47 virtual void PostMessageFromNativeProcess(int port_id, 49 virtual void PostMessageFromNativeProcess(int port_id,
48 const std::string& message) = 0; 50 const std::string& message) = 0;
49 virtual void CloseChannel(int port_id, 51 virtual void CloseChannel(int port_id,
50 const std::string& error_message) = 0; 52 const std::string& error_message) = 0;
51 }; 53 };
52 54
53 virtual ~NativeMessageProcessHost(); 55 virtual ~NativeMessageProcessHost();
54 56
57 // Verifies that the native messaging host with the specified name is allowed
58 // by the system policies.
59 static bool IsHostAllowed(
60 const PrefService* pref_service,
61 const std::string& native_host_name);
62
55 static scoped_ptr<NativeMessageProcessHost> Create( 63 static scoped_ptr<NativeMessageProcessHost> Create(
56 gfx::NativeView native_view, 64 gfx::NativeView native_view,
57 base::WeakPtr<Client> weak_client_ui, 65 base::WeakPtr<Client> weak_client_ui,
58 const std::string& source_extension_id, 66 const std::string& source_extension_id,
59 const std::string& native_host_name, 67 const std::string& native_host_name,
60 int destination_port); 68 int destination_port);
61 69
62 // Create using specified |launcher|. Used in tests. 70 // Create using specified |launcher|. Used in tests.
63 static scoped_ptr<NativeMessageProcessHost> CreateWithLauncher( 71 static scoped_ptr<NativeMessageProcessHost> CreateWithLauncher(
64 base::WeakPtr<Client> weak_client_ui, 72 base::WeakPtr<Client> weak_client_ui,
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 170
163 // Set to true when a write is pending. 171 // Set to true when a write is pending.
164 bool write_pending_; 172 bool write_pending_;
165 173
166 DISALLOW_COPY_AND_ASSIGN(NativeMessageProcessHost); 174 DISALLOW_COPY_AND_ASSIGN(NativeMessageProcessHost);
167 }; 175 };
168 176
169 } // namespace extensions 177 } // namespace extensions
170 178
171 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H _ 179 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_NATIVE_MESSAGE_PROCESS_HOST_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698