Index: chrome/renderer/render_view.cc |
=================================================================== |
--- chrome/renderer/render_view.cc (revision 46794) |
+++ chrome/renderer/render_view.cc (working copy) |
@@ -86,6 +86,7 @@ |
#include "third_party/WebKit/WebKit/chromium/public/WebFormElement.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebFrame.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebHistoryItem.h" |
+#include "third_party/WebKit/WebKit/chromium/public/WebIconLoadingCompletion.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebImage.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebInputElement.h" |
#include "third_party/WebKit/WebKit/chromium/public/WebNode.h" |
@@ -172,6 +173,7 @@ |
using WebKit::WebFormElement; |
using WebKit::WebFrame; |
using WebKit::WebHistoryItem; |
+using WebKit::WebIconLoadingCompletion; |
using WebKit::WebImage; |
using WebKit::WebInputElement; |
using WebKit::WebMediaPlayer; |
@@ -375,6 +377,7 @@ |
ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), |
devtools_agent_(NULL), |
devtools_client_(NULL), |
+ choose_icon_for_files_counter_(0), |
history_list_offset_(-1), |
history_list_length_(0), |
has_unload_listener_(false), |
@@ -630,6 +633,8 @@ |
IPC_MESSAGE_HANDLER(ViewMsg_SetAltErrorPageURL, OnSetAltErrorPageURL) |
IPC_MESSAGE_HANDLER(ViewMsg_InstallMissingPlugin, OnInstallMissingPlugin) |
IPC_MESSAGE_HANDLER(ViewMsg_RunFileChooserResponse, OnFileChooserResponse) |
+ IPC_MESSAGE_HANDLER(ViewMsg_ChooseIconForFilesResponse, |
+ OnChooseIconForFilesResponse) |
IPC_MESSAGE_HANDLER(ViewMsg_EnableViewSourceMode, OnEnableViewSourceMode) |
IPC_MESSAGE_HANDLER(ViewMsg_GetAllSavableResourceLinksForCurrentPage, |
OnGetAllSavableResourceLinksForCurrentPage) |
@@ -1811,6 +1816,20 @@ |
word)); |
} |
+bool RenderView::chooseIconForFiles( |
+ const WebKit::WebVector<WebKit::WebString>& filenames, |
+ WebIconLoadingCompletion* completion) { |
+ icon_loading_map_[choose_icon_for_files_counter_] = completion; |
+ |
+ std::vector<FilePath> file_paths; |
+ file_paths.reserve(filenames.size()); |
+ for (unsigned i = 0; i < filenames.size(); ++i) |
+ file_paths.push_back(webkit_glue::WebStringToFilePath(filenames[i])); |
+ int request_id = choose_icon_for_files_counter_++; |
+ Send(new ViewHostMsg_ChooseIconForFiles(routing_id_, request_id, file_paths)); |
+ return true; |
+} |
+ |
bool RenderView::runFileChooser( |
const WebKit::WebFileChooserParams& params, |
WebFileChooserCompletion* chooser_completion) { |
@@ -3833,6 +3852,20 @@ |
first_default_plugin_->InstallMissingPlugin(); |
} |
+void RenderView::OnChooseIconForFilesResponse( |
+ int request_id, const std::vector<unsigned char>& icon_data) { |
+ IconLoadingMap::iterator it = icon_loading_map_.find(request_id); |
+ if (it == icon_loading_map_.end()) |
+ return; |
+ WebIconLoadingCompletion* completion = it->second; |
+ icon_loading_map_.erase(it); |
+ |
+ // reinterpret_cast: No need to care signedness of binary data. |
+ WebData web_data(reinterpret_cast<const char*>(&icon_data[0]), |
+ icon_data.size()); |
+ completion->iconLoaded(web_data); |
+} |
+ |
void RenderView::OnFileChooserResponse(const std::vector<FilePath>& paths) { |
// This could happen if we navigated to a different page before the user |
// closed the chooser. |