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

Unified 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, 4 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/hyphenator/hyphenator_message_filter.h
===================================================================
--- content/browser/hyphenator/hyphenator_message_filter.h (revision 0)
+++ content/browser/hyphenator/hyphenator_message_filter.h (revision 0)
@@ -0,0 +1,79 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_HYPHENATOR_HYPHENATOR_MESSAGE_FILTER_H_
+#define CONTENT_BROWSER_HYPHENATOR_HYPHENATOR_MESSAGE_FILTER_H_
+
+#include "base/compiler_specific.h"
+#include "base/file_path.h"
+#include "base/memory/weak_ptr.h"
+#include "base/platform_file.h"
+#include "content/common/content_export.h"
+#include "content/public/browser/browser_message_filter.h"
+
+namespace content {
+class RenderProcessHost;
+
+// This class is a message filter that handles a HyphenatorHost message. When
+// this class receives a HyphenatorHostMsg_OpenDictionary message, it opens the
+// specified dictionary and sends its file handle.
+class CONTENT_EXPORT HyphenatorMessageFilter
+ : public content::BrowserMessageFilter {
+ public:
+ explicit HyphenatorMessageFilter(
+ content::RenderProcessHost* render_process_host);
+
+ // Changes the directory that includes dictionary files. This function
+ // provides a method that allows applications to change the directory
+ // containing hyphenation dictionaries. When a renderer requests a hyphnation
+ // dictionary, this class appends a file name (which consists of a locale, a
+ // version number, and an extension) and use it as a dictionary file. That is,
+ // This class opens the file "|dictionary_path_|/|locale|-1-0.dic".
tony 2012/08/22 19:05:50 Nit: This comment feels verbose. I would just kee
Hironori Bono 2012/08/27 06:57:28 Done. Thanks for noticing my redundant comments.
+ void SetDictionaryBase(const FilePath& directory);
+
+ // content::BrowserMessageFilter implementation.
+ virtual void OverrideThreadForMessage(
+ const IPC::Message& message,
+ content::BrowserThread::ID* thread) OVERRIDE;
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok) OVERRIDE;
+
+ private:
+ friend class TestHyphenatorMessageFilter;
+
+ virtual ~HyphenatorMessageFilter();
+
+ // Called when this object receives HyphenatorHostMsg_OpenDictionary messages.
+ virtual void OnOpenDictionary(const string16& locale);
+
+ // Opens a hyphenation dictionary for the specified locale. When this locale
+ // is an empty string, this function uses US English ("en-US").
+ void OpenDictionary(const string16& locale);
+
+ // Sends the hyphenation dictionary file to a renderer in response to its
+ // request. If this class cannot open the specified dictionary file, this
+ // function sends an IPC::nvalidPlatformFileForTransit value to tell the
tony 2012/08/22 19:05:50 Nit: typo: nvalidPlatformFileForTransit -> Invalid
Hironori Bono 2012/08/27 06:57:28 Done. Thanks for noticing this typo.
+ // renderer that a browser cannot open the file.
+ void SendDictionary();
+
+ // The RenderProcessHost object that owns this filter. This class uses this
+ // object to retrieve the process handle used for creating
+ // PlatformFileForTransit objects.
+ content::RenderProcessHost* render_process_host_;
+
+ // The directory that includes dictionary files. The default value is the
+ // directory containing the executable file.
+ FilePath dictionary_base_;
+
+ // A cached dictionary file.
+ base::PlatformFile dictionary_file_;
+
+ base::WeakPtrFactory<HyphenatorMessageFilter> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(HyphenatorMessageFilter);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_HYPHENATOR_HYPHENATOR_MESSAGE_FILTER_H_
Property changes on: content\browser\hyphenator\hyphenator_message_filter.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698