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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/browser/history/download_row.h" | 10 #include "chrome/browser/history/download_row.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void reset_download_updated() { download_updated_.reset(); } | 81 void reset_download_updated() { download_updated_.reset(); } |
82 | 82 |
83 protected: | 83 protected: |
84 virtual content::WebContents* GetWebUIWebContents() OVERRIDE { | 84 virtual content::WebContents* GetWebUIWebContents() OVERRIDE { |
85 return NULL; | 85 return NULL; |
86 } | 86 } |
87 | 87 |
88 virtual void CallDownloadsList(const base::ListValue& downloads) OVERRIDE { | 88 virtual void CallDownloadsList(const base::ListValue& downloads) OVERRIDE { |
89 downloads_list_.reset(downloads.DeepCopy()); | 89 downloads_list_.reset(downloads.DeepCopy()); |
90 if (waiting_list_) { | 90 if (waiting_list_) { |
91 content::BrowserThread::PostTask( | 91 content::BrowserThread::PostTask(content::BrowserThread::UI, |
92 content::BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure()); | 92 FROM_HERE, |
| 93 base::MessageLoop::QuitClosure()); |
93 } | 94 } |
94 } | 95 } |
95 | 96 |
96 virtual void CallDownloadUpdated(const base::ListValue& download) OVERRIDE { | 97 virtual void CallDownloadUpdated(const base::ListValue& download) OVERRIDE { |
97 download_updated_.reset(download.DeepCopy()); | 98 download_updated_.reset(download.DeepCopy()); |
98 if (waiting_updated_) { | 99 if (waiting_updated_) { |
99 content::BrowserThread::PostTask( | 100 content::BrowserThread::PostTask(content::BrowserThread::UI, |
100 content::BrowserThread::UI, FROM_HERE, MessageLoop::QuitClosure()); | 101 FROM_HERE, |
| 102 base::MessageLoop::QuitClosure()); |
101 } | 103 } |
102 } | 104 } |
103 | 105 |
104 private: | 106 private: |
105 scoped_ptr<base::ListValue> downloads_list_; | 107 scoped_ptr<base::ListValue> downloads_list_; |
106 scoped_ptr<base::ListValue> download_updated_; | 108 scoped_ptr<base::ListValue> download_updated_; |
107 bool waiting_list_; | 109 bool waiting_list_; |
108 bool waiting_updated_; | 110 bool waiting_updated_; |
109 | 111 |
110 DISALLOW_COPY_AND_ASSIGN(MockDownloadsDOMHandler); | 112 DISALLOW_COPY_AND_ASSIGN(MockDownloadsDOMHandler); |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record | 245 // TODO(benjhayden): Test incognito, both downloads_list() and that on-record |
244 // calls can't access off-record items. | 246 // calls can't access off-record items. |
245 | 247 |
246 // TODO(benjhayden): Test that bad download ids incoming from the javascript are | 248 // TODO(benjhayden): Test that bad download ids incoming from the javascript are |
247 // dropped on the floor. | 249 // dropped on the floor. |
248 | 250 |
249 // TODO(benjhayden): Test that IsTemporary() downloads are not shown. | 251 // TODO(benjhayden): Test that IsTemporary() downloads are not shown. |
250 | 252 |
251 // TODO(benjhayden): Test that RemoveObserver is called on all download items, | 253 // TODO(benjhayden): Test that RemoveObserver is called on all download items, |
252 // including items that crossed IsTemporary() and back. | 254 // including items that crossed IsTemporary() and back. |
OLD | NEW |