Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / webui / print_preview / print_preview_handler.cc
index ed2c3d5..4a9059b 100644 (file)
@@ -301,8 +301,8 @@ std::string GetDefaultPrinterOnFileThread() {
 class PrintingContextDelegate : public printing::PrintingContext::Delegate {
  public:
   // PrintingContext::Delegate methods.
-  virtual gfx::NativeView GetParentView() OVERRIDE { return NULL; }
-  virtual std::string GetAppLocale() OVERRIDE {
+  gfx::NativeView GetParentView() override { return NULL; }
+  std::string GetAppLocale() override {
     return g_browser_process->GetApplicationLocale();
   }
 };
@@ -539,14 +539,14 @@ class PrintPreviewHandler::AccessTokenService
     }
   }
 
-  virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
-                                 const std::string& access_token,
-                                 const base::Time& expiration_time) OVERRIDE {
+  void OnGetTokenSuccess(const OAuth2TokenService::Request* request,
+                         const std::string& access_token,
+                         const base::Time& expiration_time) override {
     OnServiceResponce(request, access_token);
   }
 
-  virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request,
-                                 const GoogleServiceAuthError& error) OVERRIDE {
+  void OnGetTokenFailure(const OAuth2TokenService::Request* request,
+                         const GoogleServiceAuthError& error) override {
     OnServiceResponce(request, std::string());
   }
 
@@ -602,11 +602,11 @@ void PrintPreviewHandler::RegisterMessages() {
   web_ui()->RegisterMessageCallback("getPrinterCapabilities",
       base::Bind(&PrintPreviewHandler::HandleGetPrinterCapabilities,
                  base::Unretained(this)));
-#if !defined(DISABLE_BASIC_PRINTING)
+#if defined(ENABLE_BASIC_PRINTING)
   web_ui()->RegisterMessageCallback("showSystemDialog",
       base::Bind(&PrintPreviewHandler::HandleShowSystemDialog,
                  base::Unretained(this)));
-#endif  // !DISABLE_BASIC_PRINTING
+#endif  // ENABLE_BASIC_PRINTING
   web_ui()->RegisterMessageCallback("signIn",
       base::Bind(&PrintPreviewHandler::HandleSignin,
                  base::Unretained(this)));
@@ -634,9 +634,6 @@ void PrintPreviewHandler::RegisterMessages() {
   web_ui()->RegisterMessageCallback("getInitialSettings",
       base::Bind(&PrintPreviewHandler::HandleGetInitialSettings,
                  base::Unretained(this)));
-  web_ui()->RegisterMessageCallback("printWithCloudPrintDialog",
-      base::Bind(&PrintPreviewHandler::HandlePrintWithCloudPrintDialog,
-                 base::Unretained(this)));
   web_ui()->RegisterMessageCallback("forceOpenNewTab",
       base::Bind(&PrintPreviewHandler::HandleForceOpenNewTab,
                  base::Unretained(this)));
@@ -1021,35 +1018,6 @@ void PrintPreviewHandler::HandleGetAccessToken(const base::ListValue* args) {
   token_service_->RequestToken(type);
 }
 
-void PrintPreviewHandler::PrintWithCloudPrintDialog() {
-  // Record the number of times the user asks to print via cloud print
-  // instead of the print preview dialog.
-  ReportStats();
-
-  scoped_refptr<base::RefCountedBytes> data;
-  base::string16 title;
-  if (!GetPreviewDataAndTitle(&data, &title)) {
-    // Nothing to print, no preview available.
-    return;
-  }
-
-  gfx::NativeWindow modal_parent = platform_util::GetTopLevel(
-      preview_web_contents()->GetNativeView());
-  print_dialog_cloud::CreatePrintDialogForBytes(
-      preview_web_contents()->GetBrowserContext(),
-      modal_parent,
-      data.get(),
-      title,
-      base::string16(),
-      std::string("application/pdf"));
-
-  // Once the cloud print dialog comes up we're no longer in a background
-  // printing situation.  Close the print preview.
-  // TODO(abodenha@chromium.org) The flow should be changed as described in
-  // http://code.google.com/p/chromium/issues/detail?id=44093
-  ClosePreviewDialog();
-}
-
 void PrintPreviewHandler::HandleManageCloudPrint(
     const base::ListValue* /*args*/) {
   ++manage_cloud_printers_dialog_request_count_;
@@ -1061,7 +1029,7 @@ void PrintPreviewHandler::HandleManageCloudPrint(
       false));
 }
 
-#if !defined(DISABLE_BASIC_PRINTING)
+#if defined(ENABLE_BASIC_PRINTING)
 void PrintPreviewHandler::HandleShowSystemDialog(
     const base::ListValue* /*args*/) {
   ReportStats();
@@ -1081,7 +1049,7 @@ void PrintPreviewHandler::HandleShowSystemDialog(
       static_cast<PrintPreviewUI*>(web_ui()->GetController());
   print_preview_ui->OnCancelPendingPreviewRequest();
 }
-#endif  // !DISABLE_BASIC_PRINTING
+#endif  // ENABLE_BASIC_PRINTING
 
 void PrintPreviewHandler::HandleManagePrinters(
     const base::ListValue* /*args*/) {
@@ -1089,17 +1057,6 @@ void PrintPreviewHandler::HandleManagePrinters(
   printing::PrinterManagerDialog::ShowPrinterManagerDialog();
 }
 
-void PrintPreviewHandler::HandlePrintWithCloudPrintDialog(
-    const base::ListValue* args) {
-  int page_count = 0;
-  if (!args || !args->GetInteger(0, &page_count))
-    return;
-  UMA_HISTOGRAM_COUNTS("PrintPreview.PageCount.PrintToCloudPrintWebDialog",
-                       page_count);
-
-  PrintWithCloudPrintDialog();
-}
-
 void PrintPreviewHandler::HandleClosePreviewDialog(
     const base::ListValue* /*args*/) {
   ReportStats();
@@ -1327,11 +1284,11 @@ void PrintPreviewHandler::OnPrintPreviewFailed() {
   ReportUserActionHistogram(PREVIEW_FAILED);
 }
 
-#if !defined(DISABLE_BASIC_PRINTING)
+#if defined(ENABLE_BASIC_PRINTING)
 void PrintPreviewHandler::ShowSystemDialog() {
   HandleShowSystemDialog(NULL);
 }
-#endif  // !DISABLE_BASIC_PRINTING
+#endif  // ENABLE_BASIC_PRINTING
 
 void PrintPreviewHandler::FileSelected(const base::FilePath& path,
                                        int index, void* params) {