Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/ui/webui/downloads_dom_handler.cc

Issue 10452009: Improve the UI for disabling off-store extension install. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments, fixed tests Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/downloads_dom_handler.h" 5 #include "chrome/browser/ui/webui/downloads_dom_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/string_piece.h" 15 #include "base/string_piece.h"
16 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
17 #include "base/utf_string_conversions.h" 17 #include "base/utf_string_conversions.h"
18 #include "base/values.h" 18 #include "base/values.h"
19 #include "chrome/browser/browser_process.h" 19 #include "chrome/browser/browser_process.h"
20 #include "chrome/browser/download/chrome_download_manager_delegate.h" 20 #include "chrome/browser/download/download_crx_util.h"
21 #include "chrome/browser/download/download_danger_prompt.h" 21 #include "chrome/browser/download/download_danger_prompt.h"
22 #include "chrome/browser/download/download_history.h" 22 #include "chrome/browser/download/download_history.h"
23 #include "chrome/browser/download/download_prefs.h" 23 #include "chrome/browser/download/download_prefs.h"
24 #include "chrome/browser/download/download_service.h" 24 #include "chrome/browser/download/download_service.h"
25 #include "chrome/browser/download/download_service_factory.h" 25 #include "chrome/browser/download/download_service_factory.h"
26 #include "chrome/browser/download/download_util.h" 26 #include "chrome/browser/download/download_util.h"
27 #include "chrome/browser/platform_util.h" 27 #include "chrome/browser/platform_util.h"
28 #include "chrome/browser/profiles/profile.h" 28 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 29 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
30 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 30 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // results. 206 // results.
207 if (original_profile_download_manager_) { 207 if (original_profile_download_manager_) {
208 original_profile_download_manager_->SearchDownloads( 208 original_profile_download_manager_->SearchDownloads(
209 WideToUTF16(search_text_), &download_items_); 209 WideToUTF16(search_text_), &download_items_);
210 } 210 }
211 211
212 sort(download_items_.begin(), download_items_.end(), DownloadItemSorter()); 212 sort(download_items_.begin(), download_items_.end(), DownloadItemSorter());
213 213
214 // Remove any extension downloads. 214 // Remove any extension downloads.
215 for (size_t i = 0; i < download_items_.size();) { 215 for (size_t i = 0; i < download_items_.size();) {
216 if (ChromeDownloadManagerDelegate::IsExtensionDownload(download_items_[i])) 216 if (download_crx_util::IsExtensionDownload(*download_items_[i]))
217 download_items_.erase(download_items_.begin() + i); 217 download_items_.erase(download_items_.begin() + i);
218 else 218 else
219 i++; 219 i++;
220 } 220 }
221 221
222 // Add ourself to all download items as an observer. 222 // Add ourself to all download items as an observer.
223 for (OrderedDownloads::iterator it = download_items_.begin(); 223 for (OrderedDownloads::iterator it = download_items_.begin();
224 it != download_items_.end(); ++it) { 224 it != download_items_.end(); ++it) {
225 if (static_cast<int>(it - download_items_.begin()) > kMaxDownloads) 225 if (static_cast<int>(it - download_items_.begin()) > kMaxDownloads)
226 break; 226 break;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 404 }
405 405
406 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue( 406 content::DownloadItem* DownloadsDOMHandler::GetDownloadByValue(
407 const ListValue* args) { 407 const ListValue* args) {
408 int id; 408 int id;
409 if (ExtractIntegerValue(args, &id)) { 409 if (ExtractIntegerValue(args, &id)) {
410 return GetDownloadById(id); 410 return GetDownloadById(id);
411 } 411 }
412 return NULL; 412 return NULL;
413 } 413 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698