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

Side by Side Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 7552028: Injected CSS localization fix (see bug no.) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Typo. Created 9 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 unified diff | Download patch | Annotate | Revision Log
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 #include "chrome/browser/renderer_host/chrome_render_message_filter.h" 5 #include "chrome/browser/renderer_host/chrome_render_message_filter.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/automation/automation_resource_message_filter.h" 9 #include "chrome/browser/automation/automation_resource_message_filter.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 extension_path, extension_id, default_locale, reply_msg)); 316 extension_path, extension_id, default_locale, reply_msg));
317 } 317 }
318 318
319 void ChromeRenderMessageFilter::OnGetExtensionMessageBundleOnFileThread( 319 void ChromeRenderMessageFilter::OnGetExtensionMessageBundleOnFileThread(
320 const FilePath& extension_path, 320 const FilePath& extension_path,
321 const std::string& extension_id, 321 const std::string& extension_id,
322 const std::string& default_locale, 322 const std::string& default_locale,
323 IPC::Message* reply_msg) { 323 IPC::Message* reply_msg) {
324 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 324 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
325 325
326 std::map<std::string, std::string> dictionary_map; 326 scoped_ptr<ExtensionMessageBundle::SubstitutionMap> dictionary_map(
327 if (!default_locale.empty()) { 327 extension_file_util::LoadExtensionMessageBundleSubstitutionMap(
328 // Touch disk only if extension is localized. 328 extension_path,
329 std::string error; 329 extension_id,
330 scoped_ptr<ExtensionMessageBundle> bundle( 330 default_locale));
331 extension_file_util::LoadExtensionMessageBundle(
332 extension_path, default_locale, &error));
333
334 if (bundle.get())
335 dictionary_map = *bundle->dictionary();
336 }
337
338 // Add @@extension_id reserved message here, so it's available to
339 // non-localized extensions too.
340 dictionary_map.insert(
341 std::make_pair(ExtensionMessageBundle::kExtensionIdKey, extension_id));
342 331
343 ExtensionHostMsg_GetMessageBundle::WriteReplyParams( 332 ExtensionHostMsg_GetMessageBundle::WriteReplyParams(
344 reply_msg, dictionary_map); 333 reply_msg, *dictionary_map);
345 Send(reply_msg); 334 Send(reply_msg);
346 } 335 }
347 336
348 void ChromeRenderMessageFilter::OnExtensionAddListener( 337 void ChromeRenderMessageFilter::OnExtensionAddListener(
349 const std::string& extension_id, 338 const std::string& extension_id,
350 const std::string& event_name) { 339 const std::string& event_name) {
351 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id_); 340 RenderProcessHost* process = RenderProcessHost::FromID(render_process_id_);
352 if (!process || !profile_->GetExtensionEventRouter()) 341 if (!process || !profile_->GetExtensionEventRouter())
353 return; 342 return;
354 343
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 reply_msg, url); 522 reply_msg, url);
534 } 523 }
535 524
536 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message, 525 void ChromeRenderMessageFilter::OnSetCookie(const IPC::Message& message,
537 const GURL& url, 526 const GURL& url,
538 const GURL& first_party_for_cookies, 527 const GURL& first_party_for_cookies,
539 const std::string& cookie) { 528 const std::string& cookie) {
540 AutomationResourceMessageFilter::SetCookiesForUrl( 529 AutomationResourceMessageFilter::SetCookiesForUrl(
541 render_process_id_, message.routing_id(), url, cookie); 530 render_process_id_, message.routing_id(), url, cookie);
542 } 531 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698