| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/chrome_render_view_observer.h" | 5 #include "chrome/renderer/chrome_render_view_observer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 157 |
| 158 // Filter only. | 158 // Filter only. |
| 159 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) | 159 IPC_BEGIN_MESSAGE_MAP(ChromeRenderViewObserver, message) |
| 160 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) | 160 IPC_MESSAGE_HANDLER(ViewMsg_Navigate, OnNavigate) |
| 161 IPC_MESSAGE_HANDLER(ViewMsg_SetIsPrerendering, OnSetIsPrerendering); | 161 IPC_MESSAGE_HANDLER(ViewMsg_SetIsPrerendering, OnSetIsPrerendering); |
| 162 IPC_END_MESSAGE_MAP() | 162 IPC_END_MESSAGE_MAP() |
| 163 | 163 |
| 164 return handled; | 164 return handled; |
| 165 } | 165 } |
| 166 | 166 |
| 167 bool ChromeRenderViewObserver::CanSendWhileSwappedOut(IPC::Message* message) { |
| 168 switch (message->type()) { |
| 169 case ViewHostMsg_DomOperationResponse::ID: |
| 170 return true; |
| 171 default: |
| 172 break; |
| 173 } |
| 174 return false; |
| 175 } |
| 176 |
| 167 void ChromeRenderViewObserver::OnCaptureSnapshot() { | 177 void ChromeRenderViewObserver::OnCaptureSnapshot() { |
| 168 SkBitmap snapshot; | 178 SkBitmap snapshot; |
| 169 bool error = false; | 179 bool error = false; |
| 170 | 180 |
| 171 WebFrame* main_frame = render_view()->webview()->mainFrame(); | 181 WebFrame* main_frame = render_view()->webview()->mainFrame(); |
| 172 if (!main_frame) | 182 if (!main_frame) |
| 173 error = true; | 183 error = true; |
| 174 | 184 |
| 175 if (!error && !CaptureSnapshot(render_view()->webview(), &snapshot)) | 185 if (!error && !CaptureSnapshot(render_view()->webview(), &snapshot)) |
| 176 error = true; | 186 error = true; |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { | 695 if (net::DataURL::Parse(url, &mime_type, &char_set, &data) && !data.empty()) { |
| 686 // Decode the favicon using WebKit's image decoder. | 696 // Decode the favicon using WebKit's image decoder. |
| 687 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); | 697 webkit_glue::ImageDecoder decoder(gfx::Size(kFaviconSize, kFaviconSize)); |
| 688 const unsigned char* src_data = | 698 const unsigned char* src_data = |
| 689 reinterpret_cast<const unsigned char*>(&data[0]); | 699 reinterpret_cast<const unsigned char*>(&data[0]); |
| 690 | 700 |
| 691 return decoder.Decode(src_data, data.size()); | 701 return decoder.Decode(src_data, data.size()); |
| 692 } | 702 } |
| 693 return SkBitmap(); | 703 return SkBitmap(); |
| 694 } | 704 } |
| OLD | NEW |