OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/temp_scaffolding_stubs.h" | 5 #include "chrome/common/temp_scaffolding_stubs.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/gfx/rect.h" | 9 #include "base/gfx/rect.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "chrome/browser/browser_list.h" | 11 #include "chrome/browser/browser_list.h" |
12 #include "chrome/browser/first_run.h" | 12 #include "chrome/browser/first_run.h" |
13 #include "chrome/browser/rlz/rlz.h" | 13 #include "chrome/browser/rlz/rlz.h" |
14 | 14 |
15 #if defined(OS_LINUX) | 15 #if defined(OS_LINUX) |
16 #include "base/path_service.h" | |
17 #include "chrome/browser/dock_info.h" | 16 #include "chrome/browser/dock_info.h" |
18 #include "chrome/browser/tab_contents/tab_contents.h" | |
19 #include "chrome/common/chrome_paths.h" | |
20 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
21 #include "printing/native_metafile.h" | |
22 #endif | 18 #endif |
23 | 19 |
24 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
25 #include "chrome/browser/automation/automation_provider.h" | 21 #include "chrome/browser/automation/automation_provider.h" |
26 #include "chrome/browser/fonts_languages_window.h" | 22 #include "chrome/browser/fonts_languages_window.h" |
27 #include "chrome/browser/memory_details.h" | 23 #include "chrome/browser/memory_details.h" |
28 #include "chrome/browser/options_window.h" | 24 #include "chrome/browser/options_window.h" |
29 #endif | 25 #endif |
30 | 26 |
31 #if defined(TOOLKIT_VIEWS) | 27 #if defined(TOOLKIT_VIEWS) |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 NOTIMPLEMENTED(); | 315 NOTIMPLEMENTED(); |
320 } | 316 } |
321 | 317 |
322 void BookmarkManager::SelectInTree(Profile* profile, const BookmarkNode* node) { | 318 void BookmarkManager::SelectInTree(Profile* profile, const BookmarkNode* node) { |
323 } | 319 } |
324 void BookmarkManager::Show(Profile* profile) { | 320 void BookmarkManager::Show(Profile* profile) { |
325 } | 321 } |
326 | 322 |
327 #endif | 323 #endif |
328 | 324 |
329 //------------------------------------------------------------------------------ | |
330 | |
331 #if defined(OS_LINUX) | |
332 // TODO(myhuang): This is a quick hack for testing purpose. We should implement | |
333 // PrintViewManager and other related classes later on Linux. | |
334 namespace printing { | |
335 | |
336 void PrintViewManager::DidPrintPage( | |
337 const ViewHostMsg_DidPrintPage_Params& params) { | |
338 base::SharedMemory shared_buf(params.metafile_data_handle, true); | |
339 if (!shared_buf.Map(params.data_size)) { | |
340 NOTREACHED() << "couldn't map"; | |
341 owner_.Stop(); | |
342 return; | |
343 } | |
344 | |
345 // The only format we can use now is PDF since Cairo needs to create a | |
346 // temporary file for a PostScript surface. We do not allow disk I/O in the | |
347 // renderer. | |
348 scoped_ptr<NativeMetafile> metafile( | |
349 new NativeMetafile(printing::NativeMetafile::PDF)); | |
350 | |
351 if (!metafile->Init(shared_buf.memory(), params.data_size)) { | |
352 NOTREACHED() << "Invalid metafile header"; | |
353 shared_buf.Unmap(); | |
354 owner_.Stop(); | |
355 return; | |
356 } | |
357 | |
358 // Save the PDF file to default download location. | |
359 // NOTE: Existing file will be overwritten. | |
360 FilePath default_save_path; | |
361 if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &default_save_path)) { | |
362 NOTREACHED(); | |
363 } | |
364 FilePath save_filename = | |
365 default_save_path.Append(FilePath("chromium_printing_test.pdf")); | |
366 metafile->SaveTo(save_filename); | |
367 shared_buf.Unmap(); | |
368 } | |
369 | |
370 } // namespace printing | |
371 | |
372 #endif | |
OLD | NEW |