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

Side by Side Diff: chrome/browser/ui/search/search_ipc_router.cc

Issue 1200053004: Move more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/search_ipc_router.h" 5 #include "chrome/browser/ui/search/search_ipc_router.h"
6 6
7 #include "chrome/browser/profiles/profile.h" 7 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/search/search.h" 8 #include "chrome/browser/search/search.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "content/public/browser/navigation_details.h" 10 #include "content/public/browser/navigation_details.h"
11 #include "content/public/browser/web_contents.h" 11 #include "content/public/browser/web_contents.h"
12 12
13 namespace { 13 namespace {
14 14
15 bool IsProviderValid(const base::string16& provider) { 15 bool IsProviderValid(const base::string16& provider) {
16 // Only allow string of 8 alphanumeric characters or less as providers. 16 // Only allow string of 8 alphanumeric characters or less as providers.
17 // The empty string is considered valid and should be treated as if no 17 // The empty string is considered valid and should be treated as if no
18 // provider were specified. 18 // provider were specified.
19 if (provider.length() > 8) 19 if (provider.length() > 8)
20 return false; 20 return false;
21 for (base::string16::const_iterator it = provider.begin(); 21 for (base::string16::const_iterator it = provider.begin();
22 it != provider.end(); ++it) { 22 it != provider.end(); ++it) {
23 if (!IsAsciiAlpha(*it) && !IsAsciiDigit(*it)) 23 if (!base::IsAsciiAlpha(*it) && !base::IsAsciiDigit(*it))
24 return false; 24 return false;
25 } 25 }
26 return true; 26 return true;
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 SearchIPCRouter::SearchIPCRouter(content::WebContents* web_contents, 31 SearchIPCRouter::SearchIPCRouter(content::WebContents* web_contents,
32 Delegate* delegate, scoped_ptr<Policy> policy) 32 Delegate* delegate, scoped_ptr<Policy> policy)
33 : WebContentsObserver(web_contents), 33 : WebContentsObserver(web_contents),
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { 360 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) {
361 DCHECK(delegate); 361 DCHECK(delegate);
362 delegate_ = delegate; 362 delegate_ = delegate;
363 } 363 }
364 364
365 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { 365 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) {
366 DCHECK(policy.get()); 366 DCHECK(policy.get());
367 policy_.reset(policy.release()); 367 policy_.reset(policy.release());
368 } 368 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_view.cc ('k') | chrome/common/favicon/fallback_icon_url_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698