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

Side by Side Diff: content/browser/renderer_host/browser_render_process_host.h

Issue 6880320: Move code that talks to spellchecking out of content. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <queue> 10 #include <queue>
11 #include <string> 11 #include <string>
12 12
13 #include "base/memory/scoped_callback_factory.h" 13 #include "base/memory/scoped_callback_factory.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/platform_file.h" 15 #include "base/platform_file.h"
16 #include "base/process.h" 16 #include "base/process.h"
17 #include "base/timer.h" 17 #include "base/timer.h"
18 #include "content/browser/child_process_launcher.h" 18 #include "content/browser/child_process_launcher.h"
19 #include "content/browser/renderer_host/render_process_host.h" 19 #include "content/browser/renderer_host/render_process_host.h"
20 #include "content/common/notification_observer.h"
21 #include "content/common/notification_registrar.h"
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h"
23 #include "ui/gfx/surface/transport_dib.h" 21 #include "ui/gfx/surface/transport_dib.h"
24 22
25 class CommandLine; 23 class CommandLine;
26 class RendererMainThread; 24 class RendererMainThread;
27 class RenderWidgetHelper; 25 class RenderWidgetHelper;
28 26
29 namespace base { 27 namespace base {
30 class SharedMemory; 28 class SharedMemory;
31 } 29 }
32 30
33 // Implements a concrete RenderProcessHost for the browser process for talking 31 // Implements a concrete RenderProcessHost for the browser process for talking
34 // to actual renderer processes (as opposed to mocks). 32 // to actual renderer processes (as opposed to mocks).
35 // 33 //
36 // Represents the browser side of the browser <--> renderer communication 34 // Represents the browser side of the browser <--> renderer communication
37 // channel. There will be one RenderProcessHost per renderer process. 35 // channel. There will be one RenderProcessHost per renderer process.
38 // 36 //
39 // This object is refcounted so that it can release its resources when all 37 // This object is refcounted so that it can release its resources when all
40 // hosts using it go away. 38 // hosts using it go away.
41 // 39 //
42 // This object communicates back and forth with the RenderProcess object 40 // This object communicates back and forth with the RenderProcess object
43 // running in the renderer process. Each RenderProcessHost and RenderProcess 41 // running in the renderer process. Each RenderProcessHost and RenderProcess
44 // keeps a list of RenderView (renderer) and TabContents (browser) which 42 // keeps a list of RenderView (renderer) and TabContents (browser) which
45 // are correlated with IDs. This way, the Views and the corresponding ViewHosts 43 // are correlated with IDs. This way, the Views and the corresponding ViewHosts
46 // communicate through the two process objects. 44 // communicate through the two process objects.
47 class BrowserRenderProcessHost : public RenderProcessHost, 45 class BrowserRenderProcessHost : public RenderProcessHost,
48 public NotificationObserver,
49 public ChildProcessLauncher::Client { 46 public ChildProcessLauncher::Client {
50 public: 47 public:
51 explicit BrowserRenderProcessHost(Profile* profile); 48 explicit BrowserRenderProcessHost(Profile* profile);
52 ~BrowserRenderProcessHost(); 49 ~BrowserRenderProcessHost();
53 50
54 // RenderProcessHost implementation (public portion). 51 // RenderProcessHost implementation (public portion).
55 virtual bool Init(bool is_accessibility_enabled, bool is_extensions_process); 52 virtual bool Init(bool is_accessibility_enabled, bool is_extensions_process);
56 virtual int GetNextRoutingID(); 53 virtual int GetNextRoutingID();
57 virtual void CancelResourceRequests(int render_widget_id); 54 virtual void CancelResourceRequests(int render_widget_id);
58 virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params); 55 virtual void CrossSiteClosePageACK(const ViewMsg_ClosePage_Params& params);
(...skipping 10 matching lines...) Expand all
69 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id); 66 virtual TransportDIB* GetTransportDIB(TransportDIB::Id dib_id);
70 67
71 // IPC::Channel::Sender via RenderProcessHost. 68 // IPC::Channel::Sender via RenderProcessHost.
72 virtual bool Send(IPC::Message* msg); 69 virtual bool Send(IPC::Message* msg);
73 70
74 // IPC::Channel::Listener via RenderProcessHost. 71 // IPC::Channel::Listener via RenderProcessHost.
75 virtual bool OnMessageReceived(const IPC::Message& msg); 72 virtual bool OnMessageReceived(const IPC::Message& msg);
76 virtual void OnChannelConnected(int32 peer_pid); 73 virtual void OnChannelConnected(int32 peer_pid);
77 virtual void OnChannelError(); 74 virtual void OnChannelError();
78 75
79 // NotificationObserver implementation.
80 virtual void Observe(NotificationType type,
81 const NotificationSource& source,
82 const NotificationDetails& details);
83
84 // ChildProcessLauncher::Client implementation. 76 // ChildProcessLauncher::Client implementation.
85 virtual void OnProcessLaunched(); 77 virtual void OnProcessLaunched();
86 78
87 private: 79 private:
88 friend class VisitRelayingRenderProcessHost; 80 friend class VisitRelayingRenderProcessHost;
89 81
90 // Creates and adds the IO thread message filters. 82 // Creates and adds the IO thread message filters.
91 void CreateMessageFilters(); 83 void CreateMessageFilters();
92 84
93 // Control message handlers. 85 // Control message handlers.
94 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats); 86 void OnUpdatedCacheStats(const WebKit::WebCache::UsageStats& stats);
95 void SuddenTerminationChanged(bool enabled); 87 void SuddenTerminationChanged(bool enabled);
96 void OnUserMetricsRecordAction(const std::string& action); 88 void OnUserMetricsRecordAction(const std::string& action);
97 89
98 // Generates a command line to be used to spawn a renderer and appends the 90 // Generates a command line to be used to spawn a renderer and appends the
99 // results to |*command_line|. 91 // results to |*command_line|.
100 void AppendRendererCommandLine(CommandLine* command_line) const; 92 void AppendRendererCommandLine(CommandLine* command_line) const;
101 93
102 // Copies applicable command line switches from the given |browser_cmd| line 94 // Copies applicable command line switches from the given |browser_cmd| line
103 // flags to the output |renderer_cmd| line flags. Not all switches will be 95 // flags to the output |renderer_cmd| line flags. Not all switches will be
104 // copied over. 96 // copied over.
105 void PropagateBrowserCommandLineToRenderer(const CommandLine& browser_cmd, 97 void PropagateBrowserCommandLineToRenderer(const CommandLine& browser_cmd,
106 CommandLine* renderer_cmd) const; 98 CommandLine* renderer_cmd) const;
107 99
108 // Callers can reduce the RenderProcess' priority. 100 // Callers can reduce the RenderProcess' priority.
109 void SetBackgrounded(bool backgrounded); 101 void SetBackgrounded(bool backgrounded);
110 102
111 // The renderer has requested that we initialize its spellchecker. This should
112 // generally only be called once per session, as after the first call, all
113 // future renderers will be passed the initialization information on startup
114 // (or when the dictionary changes in some way).
115 void OnSpellCheckerRequestDictionary();
116
117 // Tell the renderer of a new word that has been added to the custom
118 // dictionary.
119 void AddSpellCheckWord(const std::string& word);
120
121 // Pass the renderer some basic intialization information. Note that the
122 // renderer will not load Hunspell until it needs to.
123 void InitSpellChecker();
124
125 // Tell the renderer that auto spell correction has been enabled/disabled.
126 void EnableAutoSpellCorrect(bool enable);
127
128 // Initializes client-side phishing detection. Starts reading the phishing 103 // Initializes client-side phishing detection. Starts reading the phishing
129 // model from the client-side detection service class. Once the model is read 104 // model from the client-side detection service class. Once the model is read
130 // OpenPhishingModelDone() is invoked. 105 // OpenPhishingModelDone() is invoked.
131 void InitClientSidePhishingDetection(); 106 void InitClientSidePhishingDetection();
132 107
133 // Called once the client-side detection service class is done with opening 108 // Called once the client-side detection service class is done with opening
134 // the model file. 109 // the model file.
135 void OpenPhishingModelDone(base::PlatformFile model_file); 110 void OpenPhishingModelDone(base::PlatformFile model_file);
136 111
137 NotificationRegistrar registrar_;
138
139 // The count of currently visible widgets. Since the host can be a container 112 // The count of currently visible widgets. Since the host can be a container
140 // for multiple widgets, it uses this count to determine when it should be 113 // for multiple widgets, it uses this count to determine when it should be
141 // backgrounded. 114 // backgrounded.
142 int32 visible_widgets_; 115 int32 visible_widgets_;
143 116
144 // Does this process have backgrounded priority. 117 // Does this process have backgrounded priority.
145 bool backgrounded_; 118 bool backgrounded_;
146 119
147 // Used to allow a RenderWidgetHost to intercept various messages on the 120 // Used to allow a RenderWidgetHost to intercept various messages on the
148 // IO thread. 121 // IO thread.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 // messages that are sent once the process handle is available. This is 153 // messages that are sent once the process handle is available. This is
181 // because the queued messages may have dependencies on the init messages. 154 // because the queued messages may have dependencies on the init messages.
182 std::queue<IPC::Message*> queued_messages_; 155 std::queue<IPC::Message*> queued_messages_;
183 156
184 base::ScopedCallbackFactory<BrowserRenderProcessHost> callback_factory_; 157 base::ScopedCallbackFactory<BrowserRenderProcessHost> callback_factory_;
185 158
186 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost); 159 DISALLOW_COPY_AND_ASSIGN(BrowserRenderProcessHost);
187 }; 160 };
188 161
189 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_ 162 #endif // CONTENT_BROWSER_RENDERER_HOST_BROWSER_RENDER_PROCESS_HOST_H_
OLDNEW
« no previous file with comments | « content/browser/DEPS ('k') | content/browser/renderer_host/browser_render_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698