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

Unified Diff: chrome/browser/ui/webui/print_preview_handler.cc

Issue 8395007: Add policy for blocking GCP printing. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 9 years, 2 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
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/print_preview_handler.cc
diff --git a/chrome/browser/ui/webui/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview_handler.cc
index 02236773360b1c1fb184637c6e7dcb781906e0c8..eca5ac827ad72437dc9826e45cc7db30d95a7314 100644
--- a/chrome/browser/ui/webui/print_preview_handler.cc
+++ b/chrome/browser/ui/webui/print_preview_handler.cc
@@ -24,6 +24,7 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/platform_util.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/printing/background_printing_manager.h"
#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
#include "chrome/browser/printing/print_dialog_cloud.h"
@@ -32,6 +33,7 @@
#include "chrome/browser/printing/print_system_task_proxy.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/printing/printer_manager_dialog.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/restore_tab_helper.h"
#include "chrome/browser/tabs/tab_strip_model.h"
#include "chrome/browser/ui/browser_list.h"
@@ -39,6 +41,7 @@
#include "chrome/browser/ui/webui/cloud_print_signin_dialog.h"
#include "chrome/browser/ui/webui/print_preview_ui.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/print_messages.h"
#include "content/browser/browser_thread.h"
#include "content/browser/renderer_host/render_view_host.h"
@@ -658,10 +661,14 @@ void PrintPreviewHandler::SetupPrinterList(const ListValue& printers) {
}
void PrintPreviewHandler::SendCloudPrintEnabled() {
- GURL gcp_url(CloudPrintURL(BrowserList::GetLastActive()->profile()).
- GetCloudPrintServiceURL());
- base::StringValue gcp_url_value(gcp_url.spec());
- web_ui_->CallJavascriptFunction("setUseCloudPrint", gcp_url_value);
+ Profile* profile = BrowserList::GetLastActive()->profile();
+ PrefService* prefs = profile->GetPrefs();
+ if (!prefs->IsManagedPreference(prefs::kCloudPrintSubmitEnabled) ||
pastarmovj 2011/10/27 09:01:23 I don't think you need the IsManagedPreference che
Albert Bodenhamer 2011/10/27 18:18:38 Done.
+ prefs->GetBoolean(prefs::kCloudPrintSubmitEnabled)) {
+ GURL gcp_url(CloudPrintURL(profile).GetCloudPrintServiceURL());
+ base::StringValue gcp_url_value(gcp_url.spec());
+ web_ui_->CallJavascriptFunction("setUseCloudPrint", gcp_url_value);
+ }
}
void PrintPreviewHandler::SendCloudPrintJob(const DictionaryValue& settings,
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/common/pref_names.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698