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

Side by Side Diff: components/dom_distiller/ios/distiller_page_ios.mm

Issue 1879613003: Convert //components/dom_distiller from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/dom_distiller/ios/distiller_page_ios.h" 5 #include "components/dom_distiller/ios/distiller_page_ios.h"
6 6
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 // Inject the script. 96 // Inject the script.
97 base::WeakPtr<DistillerPageIOS> weak_this = weak_ptr_factory_.GetWeakPtr(); 97 base::WeakPtr<DistillerPageIOS> weak_this = weak_ptr_factory_.GetWeakPtr();
98 provider_->InjectScript(script_, ^(NSString* string, NSError* error) { 98 provider_->InjectScript(script_, ^(NSString* string, NSError* error) {
99 DistillerPageIOS* distiller_page = weak_this.get(); 99 DistillerPageIOS* distiller_page = weak_this.get();
100 if (distiller_page) 100 if (distiller_page)
101 distiller_page->HandleJavaScriptResultString(string); 101 distiller_page->HandleJavaScriptResultString(string);
102 }); 102 });
103 } 103 }
104 104
105 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) { 105 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) {
106 scoped_ptr<base::Value> resultValue = base::Value::CreateNullValue(); 106 std::unique_ptr<base::Value> resultValue = base::Value::CreateNullValue();
107 if (result.length) { 107 if (result.length) {
108 scoped_ptr<base::Value> dictionaryValue = 108 std::unique_ptr<base::Value> dictionaryValue =
109 base::JSONReader::Read(base::SysNSStringToUTF8(result)); 109 base::JSONReader::Read(base::SysNSStringToUTF8(result));
110 if (dictionaryValue && 110 if (dictionaryValue &&
111 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { 111 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) {
112 resultValue = std::move(dictionaryValue); 112 resultValue = std::move(dictionaryValue);
113 } 113 }
114 } 114 }
115 OnDistillationDone(url_, resultValue.get()); 115 OnDistillationDone(url_, resultValue.get());
116 } 116 }
117 117
118 } // namespace dom_distiller 118 } // namespace dom_distiller
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698