| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/fileicon_source.h" | 5 #include "chrome/browser/ui/webui/fileicon_source.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 &cancelable_task_tracker_); | 129 &cancelable_task_tracker_); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 std::string FileIconSource::GetSource() const { | 133 std::string FileIconSource::GetSource() const { |
| 134 return kFileIconPath; | 134 return kFileIconPath; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void FileIconSource::StartDataRequest( | 137 void FileIconSource::StartDataRequest( |
| 138 const std::string& url_path, | 138 const std::string& url_path, |
| 139 bool is_incognito, | 139 int render_process_id, |
| 140 int render_view_id, |
| 140 const content::URLDataSource::GotDataCallback& callback) { | 141 const content::URLDataSource::GotDataCallback& callback) { |
| 141 std::string query; | 142 std::string query; |
| 142 base::FilePath file_path; | 143 base::FilePath file_path; |
| 143 ui::ScaleFactor scale_factor; | 144 ui::ScaleFactor scale_factor; |
| 144 IconLoader::IconSize icon_size; | 145 IconLoader::IconSize icon_size; |
| 145 GetFilePathAndQuery(url_path, &file_path, &query); | 146 GetFilePathAndQuery(url_path, &file_path, &query); |
| 146 ParseQueryParams(query, &scale_factor, &icon_size); | 147 ParseQueryParams(query, &scale_factor, &icon_size); |
| 147 FetchFileIcon(file_path, scale_factor, icon_size, callback); | 148 FetchFileIcon(file_path, scale_factor, icon_size, callback); |
| 148 } | 149 } |
| 149 | 150 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 161 .sk_bitmap(), | 162 .sk_bitmap(), |
| 162 false, | 163 false, |
| 163 &icon_data->data()); | 164 &icon_data->data()); |
| 164 | 165 |
| 165 details.callback.Run(icon_data); | 166 details.callback.Run(icon_data); |
| 166 } else { | 167 } else { |
| 167 // TODO(glen): send a dummy icon. | 168 // TODO(glen): send a dummy icon. |
| 168 details.callback.Run(NULL); | 169 details.callback.Run(NULL); |
| 169 } | 170 } |
| 170 } | 171 } |
| OLD | NEW |