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

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

Issue 2453003002: [ios] Adds a VoiceSearchController interface to the provider layer. (Closed)
Patch Set: Rebased. 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 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 #import "ios/chrome/browser/voice/voice_search_url_rewriter.h" 5 #import "ios/chrome/browser/voice/voice_search_url_rewriter.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #import "base/strings/sys_string_conversions.h" 10 #import "base/strings/sys_string_conversions.h"
11 #include "components/google/core/browser/google_util.h" 11 #include "components/google/core/browser/google_util.h"
12 #include "components/prefs/pref_service.h" 12 #include "components/prefs/pref_service.h"
13 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" 13 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
14 #include "ios/chrome/browser/pref_names.h"
15 #include "ios/chrome/browser/voice/speech_input_locale_config.h" 14 #include "ios/chrome/browser/voice/speech_input_locale_config.h"
15 #include "ios/public/provider/chrome/browser/voice/voice_search_prefs.h"
16 #include "net/base/url_util.h" 16 #include "net/base/url_util.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 bool VoiceSearchURLRewriter(GURL* url, web::BrowserState* browser_state) { 19 bool VoiceSearchURLRewriter(GURL* url, web::BrowserState* browser_state) {
20 if (!google_util::IsGoogleSearchUrl(*url)) 20 if (!google_util::IsGoogleSearchUrl(*url))
21 return false; 21 return false;
22 22
23 ios::ChromeBrowserState* chrome_browser_state = 23 ios::ChromeBrowserState* chrome_browser_state =
24 ios::ChromeBrowserState::FromBrowserState(browser_state); 24 ios::ChromeBrowserState::FromBrowserState(browser_state);
25 std::string language = 25 std::string language =
(...skipping 19 matching lines...) Expand all
45 net::AppendOrReplaceQueryParameter(rewritten_url, "hl", language); 45 net::AppendOrReplaceQueryParameter(rewritten_url, "hl", language);
46 rewritten_url = 46 rewritten_url =
47 net::AppendQueryParameter(rewritten_url, "spknlang", language); 47 net::AppendQueryParameter(rewritten_url, "spknlang", language);
48 rewritten_url = net::AppendQueryParameter(rewritten_url, "inm", "vs"); 48 rewritten_url = net::AppendQueryParameter(rewritten_url, "inm", "vs");
49 rewritten_url = net::AppendQueryParameter(rewritten_url, "vse", "1"); 49 rewritten_url = net::AppendQueryParameter(rewritten_url, "vse", "1");
50 *url = rewritten_url; 50 *url = rewritten_url;
51 51
52 // Return false so other URLRewriters can update the url if necessary. 52 // Return false so other URLRewriters can update the url if necessary.
53 return false; 53 return false;
54 } 54 }
OLDNEW
« no previous file with comments | « ios/chrome/browser/voice/voice_search_prefs_registration.cc ('k') | ios/public/provider/chrome/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698