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

Side by Side Diff: content/browser/hyphenator/hyphenator_message_filter.h

Issue 10854245: In-te-grate hy-phen-ator to con-tent. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 | « no previous file | content/browser/hyphenator/hyphenator_message_filter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_HYPHENATOR_HYPHENATOR_MESSAGE_FILTER_H_
6 #define CONTENT_BROWSER_HYPHENATOR_HYPHENATOR_MESSAGE_FILTER_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/file_path.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/platform_file.h"
12 #include "content/common/content_export.h"
13 #include "content/public/browser/browser_message_filter.h"
14
15 namespace content {
16 class RenderProcessHost;
17
18 // This class is a message filter that handles a HyphenatorHost message. When
19 // this class receives a HyphenatorHostMsg_OpenDictionary message, it opens the
20 // specified dictionary and sends its file handle.
21 class CONTENT_EXPORT HyphenatorMessageFilter
22 : public content::BrowserMessageFilter {
23 public:
24 explicit HyphenatorMessageFilter(
25 content::RenderProcessHost* render_process_host);
26
27 // Changes the directory that includes dictionary files. This function
28 // provides a method that allows applications to change the directory
29 // containing hyphenation dictionaries. When a renderer requests a hyphnation
30 // dictionary, this class appends a file name (which consists of a locale, a
31 // version number, and an extension) and use it as a dictionary file.
32 void SetDictionaryBase(const FilePath& directory);
33
34 // content::BrowserMessageFilter implementation.
35 virtual void OverrideThreadForMessage(
36 const IPC::Message& message,
37 content::BrowserThread::ID* thread) OVERRIDE;
38 virtual bool OnMessageReceived(const IPC::Message& message,
39 bool* message_was_ok) OVERRIDE;
40
41 private:
42 friend class TestHyphenatorMessageFilter;
43
44 virtual ~HyphenatorMessageFilter();
45
46 virtual void OnOpenDictionary(const string16& locale);
47
48 // Opens a hyphenation dictionary for the specified locale. When this locale
49 // is an empty string, this function uses US English ("en-US").
50 void OpenDictionary(const string16& locale);
51
52 // Sends the hyphenation dictionary file to a renderer in response to its
53 // request. If this class cannot open the specified dictionary file, this
54 // function sends an IPC::InvalidPlatformFileForTransit value to tell the
55 // renderer that a browser cannot open the file.
56 void SendDictionary();
57
58 // The RenderProcessHost object that owns this filter. This class uses this
59 // object to retrieve the process handle used for creating
60 // PlatformFileForTransit objects.
61 content::RenderProcessHost* render_process_host_;
62
63 // The directory that includes dictionary files. The default value is the
64 // directory containing the executable file.
65 FilePath dictionary_base_;
66
67 // A cached dictionary file.
68 base::PlatformFile dictionary_file_;
69
70 base::WeakPtrFactory<HyphenatorMessageFilter> weak_factory_;
71
72 DISALLOW_COPY_AND_ASSIGN(HyphenatorMessageFilter);
73 };
74
75 } // namespace content
76
77 #endif // CONTENT_BROWSER_HYPHENATOR_HYPHENATOR_MESSAGE_FILTER_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/hyphenator/hyphenator_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698