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

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

Issue 1129083003: More base::Values-related bare pointer -> scoped_ptr conversions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix bad merge Created 5 years, 7 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 "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // Inject the script. 102 // Inject the script.
103 base::WeakPtr<DistillerPageIOS> weak_this = weak_ptr_factory_.GetWeakPtr(); 103 base::WeakPtr<DistillerPageIOS> weak_this = weak_ptr_factory_.GetWeakPtr();
104 provider_->InjectScript(script_, ^(NSString* string, NSError* error) { 104 provider_->InjectScript(script_, ^(NSString* string, NSError* error) {
105 DistillerPageIOS* distiller_page = weak_this.get(); 105 DistillerPageIOS* distiller_page = weak_this.get();
106 if (distiller_page) 106 if (distiller_page)
107 distiller_page->HandleJavaScriptResultString(string); 107 distiller_page->HandleJavaScriptResultString(string);
108 }); 108 });
109 } 109 }
110 110
111 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) { 111 void DistillerPageIOS::HandleJavaScriptResultString(NSString* result) {
112 scoped_ptr<base::Value> resultValue(base::Value::CreateNullValue()); 112 scoped_ptr<base::Value> resultValue = base::Value::CreateNullValue();
113 if (result.length) { 113 if (result.length) {
114 scoped_ptr<base::Value> dictionaryValue( 114 scoped_ptr<base::Value> dictionaryValue(
115 base::JSONReader::Read(base::SysNSStringToUTF8(result))); 115 base::JSONReader::Read(base::SysNSStringToUTF8(result)));
116 if (dictionaryValue && 116 if (dictionaryValue &&
117 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) { 117 dictionaryValue->IsType(base::Value::TYPE_DICTIONARY)) {
118 resultValue = dictionaryValue.Pass(); 118 resultValue = dictionaryValue.Pass();
119 } 119 }
120 } 120 }
121 OnDistillationDone(url_, resultValue.get()); 121 OnDistillationDone(url_, resultValue.get());
122 } 122 }
123 123
124 } // namespace dom_distiller 124 } // namespace dom_distiller
OLDNEW
« no previous file with comments | « components/dom_distiller/core/distiller_unittest.cc ('k') | components/history/core/browser/top_sites_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698