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

Side by Side Diff: chrome/browser/extensions/extension_page_capture_api.cc

Issue 9566001: Hide MHTMLGenerationManager from chrome. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_page_capture_api.h" 5 #include "chrome/browser/extensions/extension_page_capture_api.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/extensions/extension_tab_util.h" 10 #include "chrome/browser/extensions/extension_tab_util.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
12 #include "chrome/common/extensions/extension_messages.h" 12 #include "chrome/common/extensions/extension_messages.h"
13 #include "content/browser/renderer_host/render_view_host.h" 13 #include "content/browser/renderer_host/render_view_host.h"
14 #include "content/browser/download/mhtml_generation_manager.h"
15 #include "content/public/browser/child_process_security_policy.h" 14 #include "content/public/browser/child_process_security_policy.h"
16 #include "content/public/browser/notification_details.h" 15 #include "content/public/browser/notification_details.h"
17 #include "content/public/browser/notification_source.h" 16 #include "content/public/browser/notification_source.h"
18 #include "content/public/browser/notification_types.h" 17 #include "content/public/browser/notification_types.h"
19 #include "content/public/browser/render_process_host.h" 18 #include "content/public/browser/render_process_host.h"
20 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
21 20
22 using content::BrowserThread; 21 using content::BrowserThread;
23 using content::ChildProcessSecurityPolicy; 22 using content::ChildProcessSecurityPolicy;
24 using content::WebContents; 23 using content::WebContents;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 119
121 if (test_delegate_) 120 if (test_delegate_)
122 test_delegate_->OnTemporaryFileCreated(mhtml_path_); 121 test_delegate_->OnTemporaryFileCreated(mhtml_path_);
123 122
124 WebContents* web_contents = GetWebContents(); 123 WebContents* web_contents = GetWebContents();
125 if (!web_contents) { 124 if (!web_contents) {
126 ReturnFailure(kTabClosedError); 125 ReturnFailure(kTabClosedError);
127 return; 126 return;
128 } 127 }
129 128
130 MHTMLGenerationManager::GenerateMHTMLCallback callback = 129 web_contents->GenerateMHTML(
131 base::Bind(&PageCaptureSaveAsMHTMLFunction::MHTMLGenerated, this); 130 mhtml_path_,
132 131 base::Bind(&PageCaptureSaveAsMHTMLFunction::MHTMLGenerated, this));
133 g_browser_process->mhtml_generation_manager()->GenerateMHTML(
134 web_contents, mhtml_path_, callback);
135 } 132 }
136 133
137 void PageCaptureSaveAsMHTMLFunction::MHTMLGenerated(const FilePath& file_path, 134 void PageCaptureSaveAsMHTMLFunction::MHTMLGenerated(const FilePath& file_path,
138 int64 mhtml_file_size) { 135 int64 mhtml_file_size) {
139 DCHECK(mhtml_path_ == file_path); 136 DCHECK(mhtml_path_ == file_path);
140 if (mhtml_file_size <= 0) { 137 if (mhtml_file_size <= 0) {
141 ReturnFailure(kMHTMLGenerationFailedError); 138 ReturnFailure(kMHTMLGenerationFailedError);
142 return; 139 return;
143 } 140 }
144 141
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() { 185 WebContents* PageCaptureSaveAsMHTMLFunction::GetWebContents() {
189 Browser* browser = NULL; 186 Browser* browser = NULL;
190 TabContentsWrapper* tab_contents_wrapper = NULL; 187 TabContentsWrapper* tab_contents_wrapper = NULL;
191 188
192 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(), 189 if (!ExtensionTabUtil::GetTabById(tab_id_, profile(), include_incognito(),
193 &browser, NULL, &tab_contents_wrapper, NULL)) { 190 &browser, NULL, &tab_contents_wrapper, NULL)) {
194 return NULL; 191 return NULL;
195 } 192 }
196 return tab_contents_wrapper->web_contents(); 193 return tab_contents_wrapper->web_contents();
197 } 194 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698