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

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

Issue 11748005: Merge 174304 (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1364/src/
Patch Set: Created 7 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
« no previous file with comments | « chrome/common/spellcheck_common.cc ('k') | no next file » | 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) 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 #include "base/base_paths.h" 5 #include "base/base_paths.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "content/browser/hyphenator/hyphenator_message_filter.h" 10 #include "content/browser/hyphenator/hyphenator_message_filter.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 } 83 }
84 84
85 void HyphenatorMessageFilter::OpenDictionary(const string16& locale) { 85 void HyphenatorMessageFilter::OpenDictionary(const string16& locale) {
86 DCHECK(dictionary_file_ == base::kInvalidPlatformFileValue); 86 DCHECK(dictionary_file_ == base::kInvalidPlatformFileValue);
87 87
88 if (dictionary_base_.empty()) { 88 if (dictionary_base_.empty()) {
89 dictionary_base_ = 89 dictionary_base_ =
90 GetContentClient()->browser()->GetHyphenDictionaryDirectory(); 90 GetContentClient()->browser()->GetHyphenDictionaryDirectory();
91 } 91 }
92 std::string rule_file = locale.empty() ? "en-US" : UTF16ToASCII(locale); 92 std::string rule_file = locale.empty() ? "en-US" : UTF16ToASCII(locale);
93
94 // Currently, only en-US is hyphenated. This is a quick fix for
95 // http://crbug.com/167122.
96 // TODO(groby): The proper fix entails validating if locale is a properly
97 // formatted locale string, but knowledge about valid locales currently
98 // resides in chrome, not content.
99 if (rule_file != "en-US")
100 return;
93 rule_file.append("-1-0.dic"); 101 rule_file.append("-1-0.dic");
94 FilePath rule_path = dictionary_base_.AppendASCII(rule_file); 102 FilePath rule_path = dictionary_base_.AppendASCII(rule_file);
95 dictionary_file_ = base::CreatePlatformFile( 103 dictionary_file_ = base::CreatePlatformFile(
96 rule_path, 104 rule_path,
97 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_OPEN, 105 base::PLATFORM_FILE_READ | base::PLATFORM_FILE_OPEN,
98 NULL, NULL); 106 NULL, NULL);
99 } 107 }
100 108
101 void HyphenatorMessageFilter::SendDictionary() { 109 void HyphenatorMessageFilter::SendDictionary() {
102 IPC::PlatformFileForTransit file = IPC::InvalidPlatformFileForTransit(); 110 IPC::PlatformFileForTransit file = IPC::InvalidPlatformFileForTransit();
103 if (dictionary_file_ != base::kInvalidPlatformFileValue) { 111 if (dictionary_file_ != base::kInvalidPlatformFileValue) {
104 file = IPC::GetFileHandleForProcess( 112 file = IPC::GetFileHandleForProcess(
105 dictionary_file_, 113 dictionary_file_,
106 render_process_host_->GetHandle(), 114 render_process_host_->GetHandle(),
107 false); 115 false);
108 } 116 }
109 Send(new HyphenatorMsg_SetDictionary(file)); 117 Send(new HyphenatorMsg_SetDictionary(file));
110 } 118 }
111 119
112 } // namespace content 120 } // namespace content
OLDNEW
« no previous file with comments | « chrome/common/spellcheck_common.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698