OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/automation/automation_provider_observers.h" | 5 #include "chrome/browser/automation/automation_provider_observers.h" |
6 | 6 |
7 #include <deque> | 7 #include <deque> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 } else { | 1386 } else { |
1387 entire_page_size_.set_height(dimension); | 1387 entire_page_size_.set_height(dimension); |
1388 | 1388 |
1389 ThumbnailGenerator* generator = | 1389 ThumbnailGenerator* generator = |
1390 g_browser_process->GetThumbnailGenerator(); | 1390 g_browser_process->GetThumbnailGenerator(); |
1391 ThumbnailGenerator::ThumbnailReadyCallback* callback = | 1391 ThumbnailGenerator::ThumbnailReadyCallback* callback = |
1392 NewCallback(this, &PageSnapshotTaker::OnSnapshotTaken); | 1392 NewCallback(this, &PageSnapshotTaker::OnSnapshotTaken); |
1393 // Don't actually start the thumbnail generator, this leads to crashes on | 1393 // Don't actually start the thumbnail generator, this leads to crashes on |
1394 // Mac, crbug.com/62986. Instead, just hook the generator to the | 1394 // Mac, crbug.com/62986. Instead, just hook the generator to the |
1395 // RenderViewHost manually. | 1395 // RenderViewHost manually. |
1396 render_view_->set_painting_observer(generator); | 1396 |
| 1397 generator->MonitorRenderer(render_view_, true); |
1397 generator->AskForSnapshot(render_view_, false, callback, | 1398 generator->AskForSnapshot(render_view_, false, callback, |
1398 entire_page_size_, entire_page_size_); | 1399 entire_page_size_, entire_page_size_); |
1399 } | 1400 } |
1400 } | 1401 } |
1401 | 1402 |
1402 void PageSnapshotTaker::OnSnapshotTaken(const SkBitmap& bitmap) { | 1403 void PageSnapshotTaker::OnSnapshotTaken(const SkBitmap& bitmap) { |
1403 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1404 base::ThreadRestrictions::ScopedAllowIO allow_io; |
1404 std::vector<unsigned char> png_data; | 1405 std::vector<unsigned char> png_data; |
1405 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); | 1406 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); |
1406 int bytes_written = file_util::WriteFile(image_path_, | 1407 int bytes_written = file_util::WriteFile(image_path_, |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 NotificationService::AllSources()); | 1633 NotificationService::AllSources()); |
1633 } | 1634 } |
1634 | 1635 |
1635 void RendererProcessClosedObserver::Observe( | 1636 void RendererProcessClosedObserver::Observe( |
1636 NotificationType type, | 1637 NotificationType type, |
1637 const NotificationSource& source, | 1638 const NotificationSource& source, |
1638 const NotificationDetails& details) { | 1639 const NotificationDetails& details) { |
1639 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); | 1640 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); |
1640 delete this; | 1641 delete this; |
1641 } | 1642 } |
OLD | NEW |