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

Unified Diff: content/browser/renderer_host/pepper/pepper_print_settings_manager.cc

Issue 478183005: Added PrintingContext::Delegate to get parent view handle and application locale. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Wed Aug 20 16:46:22 PDT 2014 Created 6 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/renderer_host/pepper/pepper_print_settings_manager.cc
diff --git a/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc b/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc
index de5f5fec949025bb431c6533e9793172f106e8e7..644d1ab9b7e5db4445d7f5ac5b39f5c3fa9ef046 100644
--- a/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc
+++ b/content/browser/renderer_host/pepper/pepper_print_settings_manager.cc
@@ -5,6 +5,8 @@
#include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/common/content_client.h"
+#include "content/public/browser/content_browser_client.h"
#include "ppapi/c/pp_errors.h"
#include "printing/printing_context.h"
#include "printing/units.h"
@@ -42,12 +44,23 @@ PP_Rect PrintAreaToPPPrintArea(const gfx::Rect& print_area,
return result;
}
+class PrintingContextDelegate : public printing::PrintingContext::Delegate {
+ public:
+ // PrintingContext::Delegate methods.
+ virtual gfx::NativeView GetParentView() OVERRIDE { return NULL; }
+ virtual std::string GetAppLocale() OVERRIDE {
+ return GetContentClient()->browser()->GetApplicationLocale();
+ }
+};
+
PepperPrintSettingsManager::Result ComputeDefaultPrintSettings() {
// This function should run on the UI thread because |PrintingContext| methods
// call into platform APIs.
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+
+ PrintingContextDelegate delegate;
scoped_ptr<printing::PrintingContext> context(
- printing::PrintingContext::Create(std::string()));
+ printing::PrintingContext::Create(&delegate));
if (!context.get() ||
context->UseDefaultSettings() != printing::PrintingContext::OK) {
return PepperPrintSettingsManager::Result(PP_PrintSettings_Dev(),

Powered by Google App Engine
This is Rietveld 408576698