Remove all uses of "using namespace std"

BUG=331299

Review URL: https://codereview.chromium.org/373443002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282614 0039d316-1c4b-4281-b951-d872f2087c98
parent a32144fb
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
Aaron Jacobs <samusaaron3@gmail.com> Aaron Jacobs <samusaaron3@gmail.com>
Aaron Leventhal <aaronlevbugs@gmail.com> Aaron Leventhal <aaronlevbugs@gmail.com>
Aaron Randolph <aaron.randolph@gmail.com> Aaron Randolph <aaron.randolph@gmail.com>
Abhishek Agarwal <abhishek.a21@samsung.com>
Adam Roben <adam@github.com> Adam Roben <adam@github.com>
Adam Treat <adam.treat@samsung.com> Adam Treat <adam.treat@samsung.com>
Adenilson Cavalcanti <a.cavalcanti@partner.samsung.com> Adenilson Cavalcanti <a.cavalcanti@partner.samsung.com>
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "content/shell/renderer/test_runner/web_test_proxy.h" #include "content/shell/renderer/test_runner/web_test_proxy.h"
using namespace blink; using namespace blink;
using namespace std;
namespace content { namespace content {
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include "third_party/WebKit/public/platform/WebCString.h" #include "third_party/WebKit/public/platform/WebCString.h"
using namespace blink; using namespace blink;
using namespace std;
namespace content { namespace content {
...@@ -56,10 +55,10 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset ...@@ -56,10 +55,10 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset
// (This is a simple version of our SpellCheckWordIterator class.) // (This is a simple version of our SpellCheckWordIterator class.)
// If the given string doesn't include any ASCII characters, we can treat the // If the given string doesn't include any ASCII characters, we can treat the
// string as valid one. // string as valid one.
base::string16::iterator firstChar = find_if(stringText.begin(), stringText.end(), isASCIIAlpha); base::string16::iterator firstChar = std::find_if(stringText.begin(), stringText.end(), isASCIIAlpha);
if (firstChar == stringText.end()) if (firstChar == stringText.end())
return true; return true;
int wordOffset = distance(stringText.begin(), firstChar); int wordOffset = std::distance(stringText.begin(), firstChar);
int maxWordLength = static_cast<int>(stringText.length()) - wordOffset; int maxWordLength = static_cast<int>(stringText.length()) - wordOffset;
int wordLength; int wordLength;
base::string16 word; base::string16 word;
...@@ -82,11 +81,11 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset ...@@ -82,11 +81,11 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset
if (*misspelledLength > 0) if (*misspelledLength > 0)
break; break;
base::string16::iterator lastChar = find_if(stringText.begin() + wordOffset, stringText.end(), isNotASCIIAlpha); base::string16::iterator lastChar = std::find_if(stringText.begin() + wordOffset, stringText.end(), isNotASCIIAlpha);
if (lastChar == stringText.end()) if (lastChar == stringText.end())
wordLength = static_cast<int>(stringText.length()) - wordOffset; wordLength = static_cast<int>(stringText.length()) - wordOffset;
else else
wordLength = distance(firstChar, lastChar); wordLength = std::distance(firstChar, lastChar);
DCHECK_LT(0, wordOffset + wordLength); DCHECK_LT(0, wordOffset + wordLength);
stringText = stringText.substr(wordOffset + wordLength); stringText = stringText.substr(wordOffset + wordLength);
...@@ -101,7 +100,7 @@ bool MockSpellCheck::hasInCache(const WebString& word) ...@@ -101,7 +100,7 @@ bool MockSpellCheck::hasInCache(const WebString& word)
return word == WebString::fromUTF8("Spell wellcome. Is it broken?") || word == WebString::fromUTF8("Spell wellcome.\x007F"); return word == WebString::fromUTF8("Spell wellcome. Is it broken?") || word == WebString::fromUTF8("Spell wellcome.\x007F");
} }
bool MockSpellCheck::isMultiWordMisspelling(const WebString& text, vector<WebTextCheckingResult>* results) bool MockSpellCheck::isMultiWordMisspelling(const WebString& text, std::vector<WebTextCheckingResult>* results)
{ {
if (text == WebString::fromUTF8("Helllo wordl.")) { if (text == WebString::fromUTF8("Helllo wordl.")) {
results->push_back(WebTextCheckingResult(WebTextDecorationTypeSpelling, 0, 6, WebString("Hello"))); results->push_back(WebTextCheckingResult(WebTextDecorationTypeSpelling, 0, 6, WebString("Hello")));
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "third_party/WebKit/public/web/WebSpeechRecognizerClient.h" #include "third_party/WebKit/public/web/WebSpeechRecognizerClient.h"
using namespace blink; using namespace blink;
using namespace std;
namespace content { namespace content {
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "third_party/WebKit/public/web/WebTextCheckingResult.h" #include "third_party/WebKit/public/web/WebTextCheckingResult.h"
using namespace blink; using namespace blink;
using namespace std;
namespace content { namespace content {
...@@ -57,7 +56,7 @@ void SpellCheckClient::spellCheck(const WebString& text, int& misspelledOffset, ...@@ -57,7 +56,7 @@ void SpellCheckClient::spellCheck(const WebString& text, int& misspelledOffset,
void SpellCheckClient::checkTextOfParagraph(const WebString& text, WebTextCheckingTypeMask mask, WebVector<WebTextCheckingResult>* webResults) void SpellCheckClient::checkTextOfParagraph(const WebString& text, WebTextCheckingTypeMask mask, WebVector<WebTextCheckingResult>* webResults)
{ {
vector<WebTextCheckingResult> results; std::vector<WebTextCheckingResult> results;
if (mask & WebTextCheckingTypeSpelling) { if (mask & WebTextCheckingTypeSpelling) {
size_t offset = 0; size_t offset = 0;
base::string16 data = text; base::string16 data = text;
...@@ -107,7 +106,7 @@ void SpellCheckClient::finishLastTextCheck() ...@@ -107,7 +106,7 @@ void SpellCheckClient::finishLastTextCheck()
{ {
if (!m_lastRequestedTextCheckingCompletion) if (!m_lastRequestedTextCheckingCompletion)
return; return;
vector<WebTextCheckingResult> results; std::vector<WebTextCheckingResult> results;
int offset = 0; int offset = 0;
base::string16 text = m_lastRequestedTextCheckString; base::string16 text = m_lastRequestedTextCheckString;
if (!m_spellcheck.isMultiWordMisspelling(WebString(text), &results)) { if (!m_spellcheck.isMultiWordMisspelling(WebString(text), &results)) {
......
...@@ -4,31 +4,29 @@ ...@@ -4,31 +4,29 @@
#include "content/shell/renderer/test_runner/TestCommon.h" #include "content/shell/renderer/test_runner/TestCommon.h"
using namespace std;
namespace content { namespace content {
namespace { namespace {
const char layoutTestsPattern[] = "/LayoutTests/"; const char layoutTestsPattern[] = "/LayoutTests/";
const string::size_type layoutTestsPatternSize = sizeof(layoutTestsPattern) - 1; const std::string::size_type layoutTestsPatternSize = sizeof(layoutTestsPattern) - 1;
const char fileUrlPattern[] = "file:/"; const char fileUrlPattern[] = "file:/";
const char fileTestPrefix[] = "(file test):"; const char fileTestPrefix[] = "(file test):";
const char dataUrlPattern[] = "data:"; const char dataUrlPattern[] = "data:";
const string::size_type dataUrlPatternSize = sizeof(dataUrlPattern) - 1; const std::string::size_type dataUrlPatternSize = sizeof(dataUrlPattern) - 1;
} // namespace } // namespace
string normalizeLayoutTestURL(const string& url) std::string normalizeLayoutTestURL(const std::string& url)
{ {
string result = url; std::string result = url;
size_t pos; size_t pos;
if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != string::npos)) { if (!url.find(fileUrlPattern) && ((pos = url.find(layoutTestsPattern)) != std::string::npos)) {
// adjust file URLs to match upstream results. // adjust file URLs to match upstream results.
result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix); result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
} else if (!url.find(dataUrlPattern)) { } else if (!url.find(dataUrlPattern)) {
// URL-escape data URLs to match results upstream. // URL-escape data URLs to match results upstream.
string path = url.substr(dataUrlPatternSize); std::string path = url.substr(dataUrlPatternSize);
result.replace(dataUrlPatternSize, url.length(), path); result.replace(dataUrlPatternSize, url.length(), path);
} }
return result; return result;
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "third_party/WebKit/public/web/WebView.h" #include "third_party/WebKit/public/web/WebView.h"
using namespace blink; using namespace blink;
using namespace std;
namespace content { namespace content {
...@@ -112,30 +111,30 @@ void TestInterfaces::setTestIsRunning(bool running) ...@@ -112,30 +111,30 @@ void TestInterfaces::setTestIsRunning(bool running)
void TestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generatePixels) void TestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generatePixels)
{ {
string spec = GURL(testURL).spec(); std::string spec = GURL(testURL).spec();
m_testRunner->setShouldGeneratePixelResults(generatePixels); m_testRunner->setShouldGeneratePixelResults(generatePixels);
if (spec.find("loading/") != string::npos) if (spec.find("loading/") != std::string::npos)
m_testRunner->setShouldDumpFrameLoadCallbacks(true); m_testRunner->setShouldDumpFrameLoadCallbacks(true);
if (spec.find("/dumpAsText/") != string::npos) { if (spec.find("/dumpAsText/") != std::string::npos) {
m_testRunner->setShouldDumpAsText(true); m_testRunner->setShouldDumpAsText(true);
m_testRunner->setShouldGeneratePixelResults(false); m_testRunner->setShouldGeneratePixelResults(false);
} }
if (spec.find("/inspector/") != string::npos if (spec.find("/inspector/") != std::string::npos
|| spec.find("/inspector-enabled/") != string::npos) || spec.find("/inspector-enabled/") != std::string::npos)
m_testRunner->clearDevToolsLocalStorage(); m_testRunner->clearDevToolsLocalStorage();
if (spec.find("/inspector/") != string::npos) { if (spec.find("/inspector/") != std::string::npos) {
// Subfolder name determines default panel to open. // Subfolder name determines default panel to open.
string settings = ""; std::string settings = "";
string test_path = spec.substr(spec.find("/inspector/") + 11); std::string test_path = spec.substr(spec.find("/inspector/") + 11);
size_t slash_index = test_path.find("/"); size_t slash_index = test_path.find("/");
if (slash_index != string::npos) { if (slash_index != std::string::npos) {
settings = base::StringPrintf( settings = base::StringPrintf(
"{\"lastActivePanel\":\"\\\"%s\\\"\"}", "{\"lastActivePanel\":\"\\\"%s\\\"\"}",
test_path.substr(0, slash_index).c_str()); test_path.substr(0, slash_index).c_str());
} }
m_testRunner->showDevTools(settings, string()); m_testRunner->showDevTools(settings, std::string());
} }
if (spec.find("/viewsource/") != string::npos) { if (spec.find("/viewsource/") != std::string::npos) {
m_testRunner->setShouldEnableViewSource(true); m_testRunner->setShouldEnableViewSource(true);
m_testRunner->setShouldGeneratePixelResults(false); m_testRunner->setShouldGeneratePixelResults(false);
m_testRunner->setShouldDumpAsMarkup(true); m_testRunner->setShouldDumpAsMarkup(true);
...@@ -149,7 +148,7 @@ void TestInterfaces::windowOpened(WebTestProxyBase* proxy) ...@@ -149,7 +148,7 @@ void TestInterfaces::windowOpened(WebTestProxyBase* proxy)
void TestInterfaces::windowClosed(WebTestProxyBase* proxy) void TestInterfaces::windowClosed(WebTestProxyBase* proxy)
{ {
vector<WebTestProxyBase*>::iterator pos = find(m_windowList.begin(), m_windowList.end(), proxy); std::vector<WebTestProxyBase*>::iterator pos = std::find(m_windowList.begin(), m_windowList.end(), proxy);
if (pos == m_windowList.end()) { if (pos == m_windowList.end()) {
NOTREACHED(); NOTREACHED();
return; return;
...@@ -182,7 +181,7 @@ WebTestProxyBase* TestInterfaces::proxy() ...@@ -182,7 +181,7 @@ WebTestProxyBase* TestInterfaces::proxy()
return m_proxy; return m_proxy;
} }
const vector<WebTestProxyBase*>& TestInterfaces::windowList() const std::vector<WebTestProxyBase*>& TestInterfaces::windowList()
{ {
return m_windowList; return m_windowList;
} }
......
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include "third_party/WebKit/public/web/WebUserGestureIndicator.h" #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
using namespace blink; using namespace blink;
using namespace std;
namespace content { namespace content {
...@@ -478,14 +477,14 @@ void TestPlugin::destroyScene() ...@@ -478,14 +477,14 @@ void TestPlugin::destroyScene()
bool TestPlugin::initProgram() bool TestPlugin::initProgram()
{ {
const string vertexSource( const std::string vertexSource(
"attribute vec4 position; \n" "attribute vec4 position; \n"
"void main() { \n" "void main() { \n"
" gl_Position = position; \n" " gl_Position = position; \n"
"} \n" "} \n"
); );
const string fragmentSource( const std::string fragmentSource(
"precision mediump float; \n" "precision mediump float; \n"
"uniform vec4 color; \n" "uniform vec4 color; \n"
"void main() { \n" "void main() { \n"
...@@ -540,7 +539,7 @@ void TestPlugin::drawPrimitive() ...@@ -540,7 +539,7 @@ void TestPlugin::drawPrimitive()
m_context->drawArrays(GL_TRIANGLES, 0, 3); m_context->drawArrays(GL_TRIANGLES, 0, 3);
} }
unsigned TestPlugin::loadShader(unsigned type, const string& source) unsigned TestPlugin::loadShader(unsigned type, const std::string& source)
{ {
unsigned shader = m_context->createShader(type); unsigned shader = m_context->createShader(type);
if (shader) { if (shader) {
...@@ -557,7 +556,7 @@ unsigned TestPlugin::loadShader(unsigned type, const string& source) ...@@ -557,7 +556,7 @@ unsigned TestPlugin::loadShader(unsigned type, const string& source)
return shader; return shader;
} }
unsigned TestPlugin::loadProgram(const string& vertexSource, const string& fragmentSource) unsigned TestPlugin::loadProgram(const std::string& vertexSource, const std::string& fragmentSource)
{ {
unsigned vertexShader = loadShader(GL_VERTEX_SHADER, vertexSource); unsigned vertexShader = loadShader(GL_VERTEX_SHADER, vertexSource);
unsigned fragmentShader = loadShader(GL_FRAGMENT_SHADER, fragmentSource); unsigned fragmentShader = loadShader(GL_FRAGMENT_SHADER, fragmentSource);
......
...@@ -7,8 +7,6 @@ ...@@ -7,8 +7,6 @@
#include <algorithm> #include <algorithm>
#include "third_party/WebKit/public/web/WebKit.h" #include "third_party/WebKit/public/web/WebKit.h"
using namespace std;
namespace content { namespace content {
WebTask::WebTask(WebTaskList* list) WebTask::WebTask(WebTaskList* list)
...@@ -39,7 +37,7 @@ void WebTaskList::registerTask(WebTask* task) ...@@ -39,7 +37,7 @@ void WebTaskList::registerTask(WebTask* task)
void WebTaskList::unregisterTask(WebTask* task) void WebTaskList::unregisterTask(WebTask* task)
{ {
vector<WebTask*>::iterator iter = find(m_tasks.begin(), m_tasks.end(), task); std::vector<WebTask*>::iterator iter = std::find(m_tasks.begin(), m_tasks.end(), task);
if (iter != m_tasks.end()) if (iter != m_tasks.end())
m_tasks.erase(iter); m_tasks.erase(iter);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment