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

Unified Diff: Source/core/page/DOMWindow.cpp

Issue 19675008: Move btoa() / atob() implementation out of DOMWindow (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/page/DOMWindow.cpp
diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp
index 830dc7edd04931cc6887740f27188cbbfbf5da95..6cde87e54c40971be7046abc00623c7a1cda25d4 100644
--- a/Source/core/page/DOMWindow.cpp
+++ b/Source/core/page/DOMWindow.cpp
@@ -29,7 +29,6 @@
#include "wtf/MainThread.h"
#include "wtf/MathExtras.h"
-#include "wtf/text/Base64.h"
#include "wtf/text/WTFString.h"
#include <algorithm>
#include "RuntimeEnabledFeatures.h"
@@ -943,38 +942,6 @@ String DOMWindow::prompt(const String& message, const String& defaultValue)
return String();
}
-String DOMWindow::btoa(const String& stringToEncode, ExceptionCode& ec)
-{
- if (stringToEncode.isNull())
- return String();
-
- if (!stringToEncode.containsOnlyLatin1()) {
- ec = InvalidCharacterError;
- return String();
- }
-
- return base64Encode(stringToEncode.latin1());
-}
-
-String DOMWindow::atob(const String& encodedString, ExceptionCode& ec)
-{
- if (encodedString.isNull())
- return String();
-
- if (!encodedString.containsOnlyLatin1()) {
- ec = InvalidCharacterError;
- return String();
- }
-
- Vector<char> out;
- if (!base64Decode(encodedString, out, Base64FailOnInvalidCharacter)) {
- ec = InvalidCharacterError;
- return String();
- }
-
- return String(out.data(), out.size());
-}
-
bool DOMWindow::find(const String& string, bool caseSensitive, bool backwards, bool wrap, bool /*wholeWord*/, bool /*searchInFrames*/, bool /*showDialog*/) const
{
if (!isCurrentlyDisplayedInFrame())

Powered by Google App Engine
This is Rietveld 408576698