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

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

Issue 1550053002: Convert Pass()→std::move() in //chrome/browser/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 <utility>
8
7 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
8 #include "chrome/browser/search/search.h" 10 #include "chrome/browser/search/search.h"
9 #include "chrome/common/render_messages.h" 11 #include "chrome/common/render_messages.h"
10 #include "components/search/search.h" 12 #include "components/search/search.h"
11 #include "content/public/browser/navigation_details.h" 13 #include "content/public/browser/navigation_details.h"
12 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
13 15
14 namespace { 16 namespace {
15 17
16 bool IsProviderValid(const base::string16& provider) { 18 bool IsProviderValid(const base::string16& provider) {
17 // Only allow string of 8 alphanumeric characters or less as providers. 19 // Only allow string of 8 alphanumeric characters or less as providers.
18 // The empty string is considered valid and should be treated as if no 20 // The empty string is considered valid and should be treated as if no
19 // provider were specified. 21 // provider were specified.
20 if (provider.length() > 8) 22 if (provider.length() > 8)
21 return false; 23 return false;
22 for (base::string16::const_iterator it = provider.begin(); 24 for (base::string16::const_iterator it = provider.begin();
23 it != provider.end(); ++it) { 25 it != provider.end(); ++it) {
24 if (!base::IsAsciiAlpha(*it) && !base::IsAsciiDigit(*it)) 26 if (!base::IsAsciiAlpha(*it) && !base::IsAsciiDigit(*it))
25 return false; 27 return false;
26 } 28 }
27 return true; 29 return true;
28 } 30 }
29 31
30 } // namespace 32 } // namespace
31 33
32 SearchIPCRouter::SearchIPCRouter(content::WebContents* web_contents, 34 SearchIPCRouter::SearchIPCRouter(content::WebContents* web_contents,
33 Delegate* delegate, scoped_ptr<Policy> policy) 35 Delegate* delegate,
36 scoped_ptr<Policy> policy)
34 : WebContentsObserver(web_contents), 37 : WebContentsObserver(web_contents),
35 delegate_(delegate), 38 delegate_(delegate),
36 policy_(policy.Pass()), 39 policy_(std::move(policy)),
37 commit_counter_(0), 40 commit_counter_(0),
38 is_active_tab_(false) { 41 is_active_tab_(false) {
39 DCHECK(web_contents); 42 DCHECK(web_contents);
40 DCHECK(delegate); 43 DCHECK(delegate);
41 DCHECK(policy_.get()); 44 DCHECK(policy_.get());
42 } 45 }
43 46
44 SearchIPCRouter::~SearchIPCRouter() {} 47 SearchIPCRouter::~SearchIPCRouter() {}
45 48
46 void SearchIPCRouter::OnNavigationEntryCommitted() { 49 void SearchIPCRouter::OnNavigationEntryCommitted() {
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 341
339 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) { 342 void SearchIPCRouter::set_delegate_for_testing(Delegate* delegate) {
340 DCHECK(delegate); 343 DCHECK(delegate);
341 delegate_ = delegate; 344 delegate_ = delegate;
342 } 345 }
343 346
344 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) { 347 void SearchIPCRouter::set_policy_for_testing(scoped_ptr<Policy> policy) {
345 DCHECK(policy.get()); 348 DCHECK(policy.get());
346 policy_.reset(policy.release()); 349 policy_.reset(policy.release());
347 } 350 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698