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 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 } else { | 1383 } else { |
1384 entire_page_size_.set_height(dimension); | 1384 entire_page_size_.set_height(dimension); |
1385 | 1385 |
1386 ThumbnailGenerator* generator = | 1386 ThumbnailGenerator* generator = |
1387 g_browser_process->GetThumbnailGenerator(); | 1387 g_browser_process->GetThumbnailGenerator(); |
1388 ThumbnailGenerator::ThumbnailReadyCallback* callback = | 1388 ThumbnailGenerator::ThumbnailReadyCallback* callback = |
1389 NewCallback(this, &PageSnapshotTaker::OnSnapshotTaken); | 1389 NewCallback(this, &PageSnapshotTaker::OnSnapshotTaken); |
1390 // Don't actually start the thumbnail generator, this leads to crashes on | 1390 // Don't actually start the thumbnail generator, this leads to crashes on |
1391 // Mac, crbug.com/62986. Instead, just hook the generator to the | 1391 // Mac, crbug.com/62986. Instead, just hook the generator to the |
1392 // RenderViewHost manually. | 1392 // RenderViewHost manually. |
1393 render_view_->set_painting_observer(generator); | 1393 |
| 1394 generator->MonitorRenderer(render_view_, true); |
1394 generator->AskForSnapshot(render_view_, false, callback, | 1395 generator->AskForSnapshot(render_view_, false, callback, |
1395 entire_page_size_, entire_page_size_); | 1396 entire_page_size_, entire_page_size_); |
1396 } | 1397 } |
1397 } | 1398 } |
1398 | 1399 |
1399 void PageSnapshotTaker::OnSnapshotTaken(const SkBitmap& bitmap) { | 1400 void PageSnapshotTaker::OnSnapshotTaken(const SkBitmap& bitmap) { |
1400 base::ThreadRestrictions::ScopedAllowIO allow_io; | 1401 base::ThreadRestrictions::ScopedAllowIO allow_io; |
1401 std::vector<unsigned char> png_data; | 1402 std::vector<unsigned char> png_data; |
1402 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); | 1403 gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, true, &png_data); |
1403 int bytes_written = file_util::WriteFile(image_path_, | 1404 int bytes_written = file_util::WriteFile(image_path_, |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 NotificationService::AllSources()); | 1630 NotificationService::AllSources()); |
1630 } | 1631 } |
1631 | 1632 |
1632 void RendererProcessClosedObserver::Observe( | 1633 void RendererProcessClosedObserver::Observe( |
1633 NotificationType type, | 1634 NotificationType type, |
1634 const NotificationSource& source, | 1635 const NotificationSource& source, |
1635 const NotificationDetails& details) { | 1636 const NotificationDetails& details) { |
1636 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); | 1637 AutomationJSONReply(automation_, reply_message_).SendSuccess(NULL); |
1637 delete this; | 1638 delete this; |
1638 } | 1639 } |
OLD | NEW |