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

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.cc

Issue 2542363002: Interrogate PpdProvider from PrintPreview. (Closed)
Patch Set: address comment from dpapad@ Created 4 years 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
« no previous file with comments | « chrome/browser/ui/webui/print_preview/printer_backend_proxy_chromeos.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/settings/chromeos/cups_printers_handler.h" 5 #include "chrome/browser/ui/webui/settings/chromeos/cups_printers_handler.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/memory/ptr_util.h" 12 #include "base/memory/ptr_util.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "base/threading/sequenced_task_runner_handle.h" 15 #include "base/threading/sequenced_task_runner_handle.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "chrome/browser/browser_process.h" 17 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/printing/ppd_provider_factory.h"
18 #include "chrome/browser/chromeos/printing/printer_pref_manager_factory.h" 19 #include "chrome/browser/chromeos/printing/printer_pref_manager_factory.h"
19 #include "chrome/browser/download/download_prefs.h" 20 #include "chrome/browser/download/download_prefs.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser_finder.h" 22 #include "chrome/browser/ui/browser_finder.h"
22 #include "chrome/browser/ui/browser_window.h" 23 #include "chrome/browser/ui/browser_window.h"
23 #include "chrome/browser/ui/chrome_select_file_policy.h" 24 #include "chrome/browser/ui/chrome_select_file_policy.h"
24 #include "chrome/common/chrome_paths.h" 25 #include "chrome/common/chrome_paths.h"
25 #include "chromeos/dbus/dbus_thread_manager.h" 26 #include "chromeos/dbus/dbus_thread_manager.h"
26 #include "chromeos/dbus/debug_daemon_client.h" 27 #include "chromeos/dbus/debug_daemon_client.h"
27 #include "chromeos/printing/fake_printer_discoverer.h" 28 #include "chromeos/printing/fake_printer_discoverer.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 74
74 return printer_info; 75 return printer_info;
75 } 76 }
76 77
77 } // namespace 78 } // namespace
78 79
79 CupsPrintersHandler::CupsPrintersHandler(content::WebUI* webui) 80 CupsPrintersHandler::CupsPrintersHandler(content::WebUI* webui)
80 : printer_discoverer_(nullptr), 81 : printer_discoverer_(nullptr),
81 profile_(Profile::FromWebUI(webui)), 82 profile_(Profile::FromWebUI(webui)),
82 weak_factory_(this) { 83 weak_factory_(this) {
83 base::FilePath ppd_cache_path = 84 ppd_provider_ = printing::CreateProvider(profile_);
84 profile_->GetPath().Append(FILE_PATH_LITERAL("PPDCache"));
85 ppd_provider_ = chromeos::printing::PpdProvider::Create(
86 google_apis::GetAPIKey(), g_browser_process->system_request_context(),
87 content::BrowserThread::GetTaskRunnerForThread(
88 content::BrowserThread::FILE),
89 chromeos::printing::PpdCache::Create(ppd_cache_path));
90 } 85 }
91 86
92 CupsPrintersHandler::~CupsPrintersHandler() {} 87 CupsPrintersHandler::~CupsPrintersHandler() {}
93 88
94 void CupsPrintersHandler::RegisterMessages() { 89 void CupsPrintersHandler::RegisterMessages() {
95 web_ui()->RegisterMessageCallback( 90 web_ui()->RegisterMessageCallback(
96 "getCupsPrintersList", 91 "getCupsPrintersList",
97 base::Bind(&CupsPrintersHandler::HandleGetCupsPrintersList, 92 base::Bind(&CupsPrintersHandler::HandleGetCupsPrintersList,
98 base::Unretained(this))); 93 base::Unretained(this)));
99 web_ui()->RegisterMessageCallback( 94 web_ui()->RegisterMessageCallback(
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 // TODO(skau): Add appropriate failure modes crbug.com/670068. 416 // TODO(skau): Add appropriate failure modes crbug.com/670068.
422 OnAddPrinterError(); 417 OnAddPrinterError();
423 return; 418 return;
424 } 419 }
425 420
426 AddPrinterToCups(std::move(printer), path, false /* never ipp everywhere */); 421 AddPrinterToCups(std::move(printer), path, false /* never ipp everywhere */);
427 } 422 }
428 423
429 } // namespace settings 424 } // namespace settings
430 } // namespace chromeos 425 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/printer_backend_proxy_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698