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

Side by Side Diff: chrome/browser/ui/webui/print_preview/print_preview_handler.cc

Issue 10905006: Get semantic capabilities from Print Backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/browser/printing/print_system_task_proxy_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | 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 "chrome/browser/ui/webui/print_preview/print_preview_handler.h" 5 #include "chrome/browser/ui/webui/print_preview/print_preview_handler.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector>
11 10
12 #include "base/base64.h" 11 #include "base/base64.h"
13 #include "base/bind.h" 12 #include "base/bind.h"
14 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
15 #include "base/i18n/file_util_icu.h" 14 #include "base/i18n/file_util_icu.h"
16 #include "base/i18n/number_formatting.h" 15 #include "base/i18n/number_formatting.h"
17 #include "base/json/json_reader.h" 16 #include "base/json/json_reader.h"
18 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
19 #include "base/memory/ref_counted_memory.h" 18 #include "base/memory/ref_counted_memory.h"
20 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 web_contents->GetDelegate()->ActivateContents(web_contents); 755 web_contents->GetDelegate()->ActivateContents(web_contents);
757 } 756 }
758 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>( 757 PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(
759 web_ui()->GetController()); 758 web_ui()->GetController());
760 print_preview_ui->OnClosePrintPreviewTab(); 759 print_preview_ui->OnClosePrintPreviewTab();
761 } 760 }
762 761
763 void PrintPreviewHandler::SendPrinterCapabilities( 762 void PrintPreviewHandler::SendPrinterCapabilities(
764 const DictionaryValue& settings_info) { 763 const DictionaryValue& settings_info) {
765 VLOG(1) << "Get printer capabilities finished"; 764 VLOG(1) << "Get printer capabilities finished";
766 // Copy so we can override with sticky values.
767 scoped_ptr<DictionaryValue> settings(settings_info.DeepCopy());
768 if (GetStickySettings()->color_model() != printing::UNKNOWN_COLOR_MODEL) {
769 settings->SetBoolean(
770 printing::kSettingSetColorAsDefault,
771 printing::isColorModelSelected(
772 GetStickySettings()->color_model()));
773 }
774 web_ui()->CallJavascriptFunction("updateWithPrinterCapabilities", 765 web_ui()->CallJavascriptFunction("updateWithPrinterCapabilities",
775 *settings); 766 settings_info);
776 } 767 }
777 768
778 void PrintPreviewHandler::SendFailedToGetPrinterCapabilities( 769 void PrintPreviewHandler::SendFailedToGetPrinterCapabilities(
779 const std::string& printer_name) { 770 const std::string& printer_name) {
780 VLOG(1) << "Get printer capabilities failed"; 771 VLOG(1) << "Get printer capabilities failed";
781 base::StringValue printer_name_value(printer_name); 772 base::StringValue printer_name_value(printer_name);
782 web_ui()->CallJavascriptFunction("failedToGetPrinterCapabilities", 773 web_ui()->CallJavascriptFunction("failedToGetPrinterCapabilities",
783 printer_name_value); 774 printer_name_value);
784 } 775 }
785 776
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
969 return; 960 return;
970 961
971 // We no longer require the initiator tab details. Remove those details 962 // We no longer require the initiator tab details. Remove those details
972 // associated with the preview tab to allow the initiator tab to create 963 // associated with the preview tab to allow the initiator tab to create
973 // another preview tab. 964 // another preview tab.
974 printing::PrintPreviewTabController* tab_controller = 965 printing::PrintPreviewTabController* tab_controller =
975 printing::PrintPreviewTabController::GetInstance(); 966 printing::PrintPreviewTabController::GetInstance();
976 if (tab_controller) 967 if (tab_controller)
977 tab_controller->EraseInitiatorTabInfo(preview_tab_contents()); 968 tab_controller->EraseInitiatorTabInfo(preview_tab_contents());
978 } 969 }
OLDNEW
« no previous file with comments | « chrome/browser/printing/print_system_task_proxy_unittest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698