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

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

Issue 2476073003: Update PpdProvider threading model. (Closed)
Patch Set: Created 4 years, 1 month 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 | « no previous file | chromeos/printing/ppd_provider.h » ('j') | chromeos/printing/ppd_provider.h » ('J')
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"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 76
77 CupsPrintersHandler::CupsPrintersHandler(content::WebUI* webui) 77 CupsPrintersHandler::CupsPrintersHandler(content::WebUI* webui)
78 : printer_discoverer_(nullptr), 78 : printer_discoverer_(nullptr),
79 profile_(Profile::FromWebUI(webui)), 79 profile_(Profile::FromWebUI(webui)),
80 weak_factory_(this) { 80 weak_factory_(this) {
81 base::FilePath ppd_cache_path; 81 base::FilePath ppd_cache_path;
82 CHECK( 82 CHECK(
83 base::PathService::Get(chrome::DIR_CHROMEOS_PPD_CACHE, &ppd_cache_path)); 83 base::PathService::Get(chrome::DIR_CHROMEOS_PPD_CACHE, &ppd_cache_path));
84 ppd_provider_ = chromeos::printing::PpdProvider::Create( 84 ppd_provider_ = chromeos::printing::PpdProvider::Create(
85 google_apis::GetAPIKey(), g_browser_process->system_request_context(), 85 google_apis::GetAPIKey(), g_browser_process->system_request_context(),
86 content::BrowserThread::GetTaskRunnerForThread(
87 content::BrowserThread::FILE)
88 .get(),
skau 2016/11/09 00:01:09 Why are you using the raw pointer instead of the s
Carlson 2016/11/10 19:22:50 Changed to scoped_refptr (see other comment)
86 chromeos::printing::PpdCache::Create(ppd_cache_path)); 89 chromeos::printing::PpdCache::Create(ppd_cache_path));
87 } 90 }
88 91
89 CupsPrintersHandler::~CupsPrintersHandler() {} 92 CupsPrintersHandler::~CupsPrintersHandler() {}
90 93
91 void CupsPrintersHandler::RegisterMessages() { 94 void CupsPrintersHandler::RegisterMessages() {
92 web_ui()->RegisterMessageCallback( 95 web_ui()->RegisterMessageCallback(
93 "getCupsPrintersList", 96 "getCupsPrintersList",
94 base::Bind(&CupsPrintersHandler::HandleGetCupsPrintersList, 97 base::Bind(&CupsPrintersHandler::HandleGetCupsPrintersList,
95 base::Unretained(this))); 98 base::Unretained(this)));
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 *printers_list); 367 *printers_list);
365 } 368 }
366 369
367 void CupsPrintersHandler::OnDiscoveryDone() { 370 void CupsPrintersHandler::OnDiscoveryDone() {
368 CallJavascriptFunction("cr.webUIListenerCallback", 371 CallJavascriptFunction("cr.webUIListenerCallback",
369 base::StringValue("on-printer-discovery-done")); 372 base::StringValue("on-printer-discovery-done"));
370 } 373 }
371 374
372 } // namespace settings 375 } // namespace settings
373 } // namespace chromeos 376 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chromeos/printing/ppd_provider.h » ('j') | chromeos/printing/ppd_provider.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698