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

Side by Side Diff: ios/chrome/browser/voice/text_to_speech_parser.mm

Issue 2505933009: [ObjC ARC] Converts ios/chrome/browser/voice:tts to ARC.Automatically generated ARCMigrate commit… (Closed)
Patch Set: make_unique 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #import "ios/chrome/browser/voice/text_to_speech_parser.h" 5 #import "ios/chrome/browser/voice/text_to_speech_parser.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" 8 #import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
9 #include "ios/web/public/web_state/web_state.h" 9 #include "ios/web/public/web_state/web_state.h"
10 #import "third_party/google_toolbox_for_mac/src/Foundation/GTMStringEncoding.h" 10 #import "third_party/google_toolbox_for_mac/src/Foundation/GTMStringEncoding.h"
11 11
12 #if !defined(__has_feature) || !__has_feature(objc_arc)
13 #error "This file requires ARC support."
14 #endif
15
12 namespace { 16 namespace {
13 17
14 // The start and end tags that delimit TTS audio data. 18 // The start and end tags that delimit TTS audio data.
15 NSString* const kTTSStartTag = @"function(){var _a_tts='"; 19 NSString* const kTTSStartTag = @"function(){var _a_tts='";
16 NSString* const kTTSEndTag = @"'"; 20 NSString* const kTTSEndTag = @"'";
17 21
18 // When |kTTSAudioDataExtractorScriptFormat| is evaluated on a Google voice 22 // When |kTTSAudioDataExtractorScriptFormat| is evaluated on a Google voice
19 // search results page, this script will extract the innerHTML from the script 23 // search results page, this script will extract the innerHTML from the script
20 // element containing TTS data. The format takes one parameter, which is the 24 // element containing TTS data. The format takes one parameter, which is the
21 // start tag from the TTS config singleton. 25 // start tag from the TTS config singleton.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 DCHECK(webState); 104 DCHECK(webState);
101 DCHECK(completion); 105 DCHECK(completion);
102 NSString* tts_extraction_script = [NSString 106 NSString* tts_extraction_script = [NSString
103 stringWithFormat:kTTSAudioDataExtractorScriptFormat, kTTSStartTag]; 107 stringWithFormat:kTTSAudioDataExtractorScriptFormat, kTTSStartTag];
104 [webState->GetJSInjectionReceiver() 108 [webState->GetJSInjectionReceiver()
105 executeJavaScript:tts_extraction_script 109 executeJavaScript:tts_extraction_script
106 completionHandler:^(id result, NSError* error) { 110 completionHandler:^(id result, NSError* error) {
107 completion(ExtractVoiceSearchAudioDataFromPageHTML(result)); 111 completion(ExtractVoiceSearchAudioDataFromPageHTML(result));
108 }]; 112 }];
109 } 113 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/voice/text_to_speech_listener.mm ('k') | ios/chrome/browser/voice/voice_search_url_rewriter.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698