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/browser/download/download_request_limiter.h" | 5 #include "chrome/browser/download/download_request_limiter.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "chrome/browser/download/download_request_infobar_delegate.h" | 9 #include "chrome/browser/download/download_request_infobar_delegate.h" |
10 #include "chrome/browser/infobars/infobar_tab_helper.h" | 10 #include "chrome/browser/infobars/infobar_tab_helper.h" |
11 #include "chrome/browser/tab_contents/tab_util.h" | 11 #include "chrome/browser/tab_contents/tab_util.h" |
12 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" | 12 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" |
13 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" | 13 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper_delegate.
h" |
14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 14 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
15 #include "content/browser/tab_contents/navigation_controller.h" | 15 #include "content/browser/tab_contents/navigation_controller.h" |
16 #include "content/browser/tab_contents/navigation_entry.h" | 16 #include "content/browser/tab_contents/navigation_entry.h" |
17 #include "content/browser/tab_contents/tab_contents.h" | 17 #include "content/browser/tab_contents/tab_contents.h" |
18 #include "content/browser/tab_contents/tab_contents_delegate.h" | 18 #include "content/browser/tab_contents/tab_contents_delegate.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/notification_source.h" | 20 #include "content/public/browser/notification_source.h" |
21 #include "content/public/browser/notification_types.h" | 21 #include "content/public/browser/notification_types.h" |
22 | 22 |
| 23 using content::BrowserThread; |
| 24 |
23 // TabDownloadState ------------------------------------------------------------ | 25 // TabDownloadState ------------------------------------------------------------ |
24 | 26 |
25 DownloadRequestLimiter::TabDownloadState::TabDownloadState( | 27 DownloadRequestLimiter::TabDownloadState::TabDownloadState( |
26 DownloadRequestLimiter* host, | 28 DownloadRequestLimiter* host, |
27 NavigationController* controller, | 29 NavigationController* controller, |
28 NavigationController* originating_controller) | 30 NavigationController* originating_controller) |
29 : host_(host), | 31 : host_(host), |
30 controller_(controller), | 32 controller_(controller), |
31 status_(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD), | 33 status_(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD), |
32 download_count_(0), | 34 download_count_(0), |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 334 |
333 void DownloadRequestLimiter::Remove(TabDownloadState* state) { | 335 void DownloadRequestLimiter::Remove(TabDownloadState* state) { |
334 DCHECK(ContainsKey(state_map_, state->controller())); | 336 DCHECK(ContainsKey(state_map_, state->controller())); |
335 state_map_.erase(state->controller()); | 337 state_map_.erase(state->controller()); |
336 delete state; | 338 delete state; |
337 } | 339 } |
338 | 340 |
339 // static | 341 // static |
340 DownloadRequestLimiter::TestingDelegate* DownloadRequestLimiter::delegate_ = | 342 DownloadRequestLimiter::TestingDelegate* DownloadRequestLimiter::delegate_ = |
341 NULL; | 343 NULL; |
OLD | NEW |