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 @@
Aaron Jacobs <samusaaron3@gmail.com>
Aaron Leventhal <aaronlevbugs@gmail.com>
Aaron Randolph <aaron.randolph@gmail.com>
Abhishek Agarwal <abhishek.a21@samsung.com>
Adam Roben <adam@github.com>
Adam Treat <adam.treat@samsung.com>
Adenilson Cavalcanti <a.cavalcanti@partner.samsung.com>
......
......@@ -8,7 +8,6 @@
#include "content/shell/renderer/test_runner/web_test_proxy.h"
using namespace blink;
using namespace std;
namespace content {
......
......@@ -9,7 +9,6 @@
#include "third_party/WebKit/public/platform/WebCString.h"
using namespace blink;
using namespace std;
namespace content {
......@@ -56,10 +55,10 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset
// (This is a simple version of our SpellCheckWordIterator class.)
// If the given string doesn't include any ASCII characters, we can treat the
// 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())
return true;
int wordOffset = distance(stringText.begin(), firstChar);
int wordOffset = std::distance(stringText.begin(), firstChar);
int maxWordLength = static_cast<int>(stringText.length()) - wordOffset;
int wordLength;
base::string16 word;
......@@ -82,11 +81,11 @@ bool MockSpellCheck::spellCheckWord(const WebString& text, int* misspelledOffset
if (*misspelledLength > 0)
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())
wordLength = static_cast<int>(stringText.length()) - wordOffset;
else
wordLength = distance(firstChar, lastChar);
wordLength = std::distance(firstChar, lastChar);
DCHECK_LT(0, wordOffset + wordLength);
stringText = stringText.substr(wordOffset + wordLength);
......@@ -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");
}
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.")) {
results->push_back(WebTextCheckingResult(WebTextDecorationTypeSpelling, 0, 6, WebString("Hello")));
......
......@@ -10,7 +10,6 @@
#include "third_party/WebKit/public/web/WebSpeechRecognizerClient.h"
using namespace blink;
using namespace std;
namespace content {
......
......@@ -11,7 +11,6 @@
#include "third_party/WebKit/public/web/WebTextCheckingResult.h"
using namespace blink;
using namespace std;
namespace content {
......@@ -57,7 +56,7 @@ void SpellCheckClient::spellCheck(const WebString& text, int& misspelledOffset,
void SpellCheckClient::checkTextOfParagraph(const WebString& text, WebTextCheckingTypeMask mask, WebVector<WebTextCheckingResult>* webResults)
{
vector<WebTextCheckingResult> results;
std::vector<WebTextCheckingResult> results;
if (mask & WebTextCheckingTypeSpelling) {
size_t offset = 0;
base::string16 data = text;
......@@ -107,7 +106,7 @@ void SpellCheckClient::finishLastTextCheck()
{
if (!m_lastRequestedTextCheckingCompletion)
return;
vector<WebTextCheckingResult> results;
std::vector<WebTextCheckingResult> results;
int offset = 0;
base::string16 text = m_lastRequestedTextCheckString;
if (!m_spellcheck.isMultiWordMisspelling(WebString(text), &results)) {
......
......@@ -4,31 +4,29 @@
#include "content/shell/renderer/test_runner/TestCommon.h"
using namespace std;
namespace content {
namespace {
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 fileTestPrefix[] = "(file test):";
const char dataUrlPattern[] = "data:";
const string::size_type dataUrlPatternSize = sizeof(dataUrlPattern) - 1;
const std::string::size_type dataUrlPatternSize = sizeof(dataUrlPattern) - 1;
} // namespace
string normalizeLayoutTestURL(const string& url)
std::string normalizeLayoutTestURL(const std::string& url)
{
string result = url;
std::string result = url;
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.
result.replace(0, pos + layoutTestsPatternSize, fileTestPrefix);
} else if (!url.find(dataUrlPattern)) {
// 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);
}
return result;
......
......@@ -24,7 +24,6 @@
#include "third_party/WebKit/public/web/WebView.h"
using namespace blink;
using namespace std;
namespace content {
......@@ -112,30 +111,30 @@ void TestInterfaces::setTestIsRunning(bool running)
void TestInterfaces::configureForTestWithURL(const WebURL& testURL, bool generatePixels)
{
string spec = GURL(testURL).spec();
std::string spec = GURL(testURL).spec();
m_testRunner->setShouldGeneratePixelResults(generatePixels);
if (spec.find("loading/") != string::npos)
if (spec.find("loading/") != std::string::npos)
m_testRunner->setShouldDumpFrameLoadCallbacks(true);
if (spec.find("/dumpAsText/") != string::npos) {
if (spec.find("/dumpAsText/") != std::string::npos) {
m_testRunner->setShouldDumpAsText(true);
m_testRunner->setShouldGeneratePixelResults(false);
}
if (spec.find("/inspector/") != string::npos
|| spec.find("/inspector-enabled/") != string::npos)
if (spec.find("/inspector/") != std::string::npos
|| spec.find("/inspector-enabled/") != std::string::npos)
m_testRunner->clearDevToolsLocalStorage();
if (spec.find("/inspector/") != string::npos) {
if (spec.find("/inspector/") != std::string::npos) {
// Subfolder name determines default panel to open.
string settings = "";
string test_path = spec.substr(spec.find("/inspector/") + 11);
std::string settings = "";
std::string test_path = spec.substr(spec.find("/inspector/") + 11);
size_t slash_index = test_path.find("/");
if (slash_index != string::npos) {
if (slash_index != std::string::npos) {
settings = base::StringPrintf(
"{\"lastActivePanel\":\"\\\"%s\\\"\"}",
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->setShouldGeneratePixelResults(false);
m_testRunner->setShouldDumpAsMarkup(true);
......@@ -149,7 +148,7 @@ void TestInterfaces::windowOpened(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()) {
NOTREACHED();
return;
......@@ -182,7 +181,7 @@ WebTestProxyBase* TestInterfaces::proxy()
return m_proxy;
}
const vector<WebTestProxyBase*>& TestInterfaces::windowList()
const std::vector<WebTestProxyBase*>& TestInterfaces::windowList()
{
return m_windowList;
}
......
......@@ -25,7 +25,6 @@
#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
using namespace blink;
using namespace std;
namespace content {
......@@ -478,14 +477,14 @@ void TestPlugin::destroyScene()
bool TestPlugin::initProgram()
{
const string vertexSource(
const std::string vertexSource(
"attribute vec4 position; \n"
"void main() { \n"
" gl_Position = position; \n"
"} \n"
);
const string fragmentSource(
const std::string fragmentSource(
"precision mediump float; \n"
"uniform vec4 color; \n"
"void main() { \n"
......@@ -540,7 +539,7 @@ void TestPlugin::drawPrimitive()
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);
if (shader) {
......@@ -557,7 +556,7 @@ unsigned TestPlugin::loadShader(unsigned type, const string& source)
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 fragmentShader = loadShader(GL_FRAGMENT_SHADER, fragmentSource);
......
......@@ -7,8 +7,6 @@
#include <algorithm>
#include "third_party/WebKit/public/web/WebKit.h"
using namespace std;
namespace content {
WebTask::WebTask(WebTaskList* list)
......@@ -39,7 +37,7 @@ void WebTaskList::registerTask(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())
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