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

Unified Diff: extensions/browser/api/capture_web_contents_function.cc

Issue 545973002: Cleaning up capture_web_contents_function. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebasing Created 6 years, 3 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: extensions/browser/api/capture_web_contents_function.cc
diff --git a/extensions/browser/api/capture_web_contents_function_impl.h b/extensions/browser/api/capture_web_contents_function.cc
similarity index 78%
rename from extensions/browser/api/capture_web_contents_function_impl.h
rename to extensions/browser/api/capture_web_contents_function.cc
index 037ac3bdf776e22d1db261dd16ea38f95b84da38..5d168d919cca50cbf4cf13694f4e84f526316b63 100644
--- a/extensions/browser/api/capture_web_contents_function_impl.h
+++ b/extensions/browser/api/capture_web_contents_function.cc
@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_IMPL_H_
-#define EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_IMPL_H_
-
#include "extensions/browser/api/capture_web_contents_function.h"
#include "base/base64.h"
@@ -24,22 +21,20 @@ using content::WebContents;
namespace extensions {
-template <typename T>
-bool CaptureWebContentsFunction<T>::HasPermission() {
+bool CaptureWebContentsFunction::HasPermission() {
return true;
}
-template <typename T>
-bool CaptureWebContentsFunction<T>::RunAsync() {
- EXTENSION_FUNCTION_VALIDATE(T::args_);
+bool CaptureWebContentsFunction::RunAsync() {
+ EXTENSION_FUNCTION_VALIDATE(args_);
context_id_ = extension_misc::kCurrentWindowId;
- T::args_->GetInteger(0, &context_id_);
+ args_->GetInteger(0, &context_id_);
scoped_ptr<ImageDetails> image_details;
- if (T::args_->GetSize() > 1) {
+ if (args_->GetSize() > 1) {
base::Value* spec = NULL;
- EXTENSION_FUNCTION_VALIDATE(T::args_->Get(1, &spec) && spec);
+ EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &spec) && spec);
image_details = ImageDetails::FromValue(*spec);
}
@@ -79,8 +74,7 @@ bool CaptureWebContentsFunction<T>::RunAsync() {
return true;
}
-template <typename T>
-void CaptureWebContentsFunction<T>::CopyFromBackingStoreComplete(
+void CaptureWebContentsFunction::CopyFromBackingStoreComplete(
bool succeeded,
const SkBitmap& bitmap) {
if (succeeded) {
@@ -90,8 +84,7 @@ void CaptureWebContentsFunction<T>::CopyFromBackingStoreComplete(
OnCaptureFailure(FAILURE_REASON_UNKNOWN);
}
-template <typename T>
-void CaptureWebContentsFunction<T>::OnCaptureSuccess(const SkBitmap& bitmap) {
+void CaptureWebContentsFunction::OnCaptureSuccess(const SkBitmap& bitmap) {
std::vector<unsigned char> data;
SkAutoLockPixels screen_capture_lock(bitmap);
bool encoded = false;
@@ -131,16 +124,8 @@ void CaptureWebContentsFunction<T>::OnCaptureSuccess(const SkBitmap& bitmap) {
base::Base64Encode(stream_as_string, &base64_result);
base64_result.insert(
0, base::StringPrintf("data:%s;base64,", mime_type.c_str()));
- T::SetResult(new base::StringValue(base64_result));
- T::SendResponse(true);
-}
-
-template <typename T>
-bool CaptureWebContentsFunction<T>::ValidationFailure(
- CaptureWebContentsFunction<T>* function) {
- return T::ValidationFailure(function);
+ SetResult(new base::StringValue(base64_result));
+ SendResponse(true);
}
} // namespace extensions
-
-#endif // EXTENSIONS_BROWSER_API_CAPTURE_WEB_CONTENTS_FUNCTION_IMPL_H_
« no previous file with comments | « extensions/browser/api/capture_web_contents_function.h ('k') | extensions/browser/api/capture_web_contents_function_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698