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

Side by Side Diff: components/translate/core/browser/translate_script.cc

Issue 818103002: Make callers of CommandLine use it via the base:: namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 12 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/translate/core/browser/translate_script.h" 5 #include "components/translate/core/browser/translate_script.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 callback_list_.push_back(callback); 59 callback_list_.push_back(callback);
60 60
61 if (fetcher_.get() != NULL) { 61 if (fetcher_.get() != NULL) {
62 // If there is already a request in progress, do nothing. |callback| will be 62 // If there is already a request in progress, do nothing. |callback| will be
63 // run on completion. 63 // run on completion.
64 return; 64 return;
65 } 65 }
66 66
67 GURL translate_script_url; 67 GURL translate_script_url;
68 // Check if command-line contains an alternative URL for translate service. 68 // Check if command-line contains an alternative URL for translate service.
69 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 69 const base::CommandLine& command_line =
70 *base::CommandLine::ForCurrentProcess();
70 if (command_line.HasSwitch(translate::switches::kTranslateScriptURL)) { 71 if (command_line.HasSwitch(translate::switches::kTranslateScriptURL)) {
71 translate_script_url = GURL(command_line.GetSwitchValueASCII( 72 translate_script_url = GURL(command_line.GetSwitchValueASCII(
72 translate::switches::kTranslateScriptURL)); 73 translate::switches::kTranslateScriptURL));
73 if (!translate_script_url.is_valid() || 74 if (!translate_script_url.is_valid() ||
74 !translate_script_url.query().empty()) { 75 !translate_script_url.query().empty()) {
75 LOG(WARNING) << "The following translate URL specified at the " 76 LOG(WARNING) << "The following translate URL specified at the "
76 << "command-line is invalid: " 77 << "command-line is invalid: "
77 << translate_script_url.spec(); 78 << translate_script_url.spec();
78 translate_script_url = GURL(); 79 translate_script_url = GURL();
79 } 80 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 151
151 for (RequestCallbackList::iterator it = callback_list_.begin(); 152 for (RequestCallbackList::iterator it = callback_list_.begin();
152 it != callback_list_.end(); 153 it != callback_list_.end();
153 ++it) { 154 ++it) {
154 it->Run(success, data); 155 it->Run(success, data);
155 } 156 }
156 callback_list_.clear(); 157 callback_list_.clear();
157 } 158 }
158 159
159 } // namespace translate 160 } // namespace translate
OLDNEW
« no previous file with comments | « components/translate/core/browser/translate_manager.cc ('k') | components/translate/core/browser/translate_script_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698