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

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

Issue 1494833002: Cleanup/ linked_ptr -> scoped_ptr from c/b/ui/webui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/media_router/query_result_manager.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 (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 <map> 9 #include <map>
10 #include <string> 10 #include <string>
11 11
12 #include "base/base64.h" 12 #include "base/base64.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/i18n/file_util_icu.h" 16 #include "base/i18n/file_util_icu.h"
17 #include "base/i18n/number_formatting.h" 17 #include "base/i18n/number_formatting.h"
18 #include "base/json/json_reader.h" 18 #include "base/json/json_reader.h"
19 #include "base/lazy_instance.h" 19 #include "base/lazy_instance.h"
20 #include "base/memory/linked_ptr.h"
21 #include "base/memory/ref_counted_memory.h" 20 #include "base/memory/ref_counted_memory.h"
21 #include "base/memory/scoped_ptr.h"
22 #include "base/metrics/histogram.h" 22 #include "base/metrics/histogram.h"
23 #include "base/path_service.h" 23 #include "base/path_service.h"
24 #include "base/prefs/pref_service.h" 24 #include "base/prefs/pref_service.h"
25 #include "base/strings/string_number_conversions.h" 25 #include "base/strings/string_number_conversions.h"
26 #include "base/strings/stringprintf.h" 26 #include "base/strings/stringprintf.h"
27 #include "base/strings/utf_string_conversions.h" 27 #include "base/strings/utf_string_conversions.h"
28 #include "base/threading/thread.h" 28 #include "base/threading/thread.h"
29 #include "base/threading/thread_restrictions.h" 29 #include "base/threading/thread_restrictions.h"
30 #include "base/values.h" 30 #include "base/values.h"
31 #include "chrome/browser/app_mode/app_mode_utils.h" 31 #include "chrome/browser/app_mode/app_mode_utils.h"
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 577
578 void OnGetTokenFailure(const OAuth2TokenService::Request* request, 578 void OnGetTokenFailure(const OAuth2TokenService::Request* request,
579 const GoogleServiceAuthError& error) override { 579 const GoogleServiceAuthError& error) override {
580 OnServiceResponce(request, std::string()); 580 OnServiceResponce(request, std::string());
581 } 581 }
582 582
583 private: 583 private:
584 void OnServiceResponce(const OAuth2TokenService::Request* request, 584 void OnServiceResponce(const OAuth2TokenService::Request* request,
585 const std::string& access_token) { 585 const std::string& access_token) {
586 for (Requests::iterator i = requests_.begin(); i != requests_.end(); ++i) { 586 for (Requests::iterator i = requests_.begin(); i != requests_.end(); ++i) {
587 if (i->second == request) { 587 if (i->second.get() == request) {
588 handler_->SendAccessToken(i->first, access_token); 588 handler_->SendAccessToken(i->first, access_token);
589 requests_.erase(i); 589 requests_.erase(i);
590 return; 590 return;
591 } 591 }
592 } 592 }
593 NOTREACHED(); 593 NOTREACHED();
594 } 594 }
595 595
596 typedef std::map<std::string, 596 using Requests =
597 linked_ptr<OAuth2TokenService::Request> > Requests; 597 std::map<std::string, scoped_ptr<OAuth2TokenService::Request>>;
598 Requests requests_; 598 Requests requests_;
599 PrintPreviewHandler* handler_; 599 PrintPreviewHandler* handler_;
600 600
601 DISALLOW_COPY_AND_ASSIGN(AccessTokenService); 601 DISALLOW_COPY_AND_ASSIGN(AccessTokenService);
602 }; 602 };
603 603
604 PrintPreviewHandler::PrintPreviewHandler() 604 PrintPreviewHandler::PrintPreviewHandler()
605 : regenerate_preview_request_count_(0), 605 : regenerate_preview_request_count_(0),
606 manage_printers_dialog_request_count_(0), 606 manage_printers_dialog_request_count_(0),
607 manage_cloud_printers_dialog_request_count_(0), 607 manage_cloud_printers_dialog_request_count_(0),
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1814 1814
1815 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() { 1815 void PrintPreviewHandler::UnregisterForGaiaCookieChanges() {
1816 if (gaia_cookie_manager_service_) 1816 if (gaia_cookie_manager_service_)
1817 gaia_cookie_manager_service_->RemoveObserver(this); 1817 gaia_cookie_manager_service_->RemoveObserver(this);
1818 } 1818 }
1819 1819
1820 void PrintPreviewHandler::SetPdfSavedClosureForTesting( 1820 void PrintPreviewHandler::SetPdfSavedClosureForTesting(
1821 const base::Closure& closure) { 1821 const base::Closure& closure) {
1822 pdf_file_saved_closure_ = closure; 1822 pdf_file_saved_closure_ = closure;
1823 } 1823 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/media_router/query_result_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698