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

Unified Diff: chrome/browser/extensions/api/page_capture/page_capture_api.cc

Issue 10806072: Refactor chrome.pageCapture to use JSON schema compiler (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
« no previous file with comments | « chrome/browser/extensions/api/page_capture/page_capture_api.h ('k') | chrome/common/extensions/api/api.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/page_capture/page_capture_api.cc
diff --git a/chrome/browser/extensions/api/page_capture/page_capture_api.cc b/chrome/browser/extensions/api/page_capture/page_capture_api.cc
index 5b366fd3af3231ebb2b81d8583d747a6c3a757f0..6da38cc052684a3d487065a3e50322cc36e419a5 100644
--- a/chrome/browser/extensions/api/page_capture/page_capture_api.cc
+++ b/chrome/browser/extensions/api/page_capture/page_capture_api.cc
@@ -26,6 +26,8 @@ using content::WebContents;
using extensions::PageCaptureSaveAsMHTMLFunction;
using webkit_blob::ShareableFileReference;
+namespace SaveAsMHTML = extensions::api::page_capture::SaveAsMHTML;
+
namespace {
// Error messages.
@@ -40,7 +42,7 @@ const char* const kTabClosedError = "Cannot find the tab for thie request.";
static PageCaptureSaveAsMHTMLFunction::TestDelegate* test_delegate_ = NULL;
-PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() : tab_id_(0) {
+PageCaptureSaveAsMHTMLFunction::PageCaptureSaveAsMHTMLFunction() {
}
PageCaptureSaveAsMHTMLFunction::~PageCaptureSaveAsMHTMLFunction() {
@@ -55,13 +57,8 @@ void PageCaptureSaveAsMHTMLFunction::SetTestDelegate(TestDelegate* delegate) {
}
bool PageCaptureSaveAsMHTMLFunction::RunImpl() {
- DictionaryValue* args;
- EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args));
-
- if (!args->HasKey("tabId"))
- return false;
-
- EXTENSION_FUNCTION_VALIDATE(args->GetInteger("tabId", &tab_id_));
+ params_ = SaveAsMHTML::Params::Create(*args_);
+ EXTENSION_FUNCTION_VALIDATE(params_.get());
AddRef(); // Balanced in ReturnFailure/ReturnSuccess()
@@ -193,8 +190,9 @@ WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() {
Browser* browser = NULL;
TabContents* tab_contents = NULL;
- if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(),
- &browser, NULL, &tab_contents, NULL)) {
+ if (!ExtensionTabUtil::GetTabById(params_->details.tab_id, profile(),
+ include_incognito(), &browser, NULL,
+ &tab_contents, NULL)) {
return NULL;
}
return tab_contents->web_contents();
« no previous file with comments | « chrome/browser/extensions/api/page_capture/page_capture_api.h ('k') | chrome/common/extensions/api/api.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698