Chromium Code Reviews| 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/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/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 // automatic downloads content settings. Alternatively, they can copy the | 90 // automatic downloads content settings. Alternatively, they can copy the |
| 91 // URL into a new tab, which will make a new DownloadRequestLimiter. | 91 // URL into a new tab, which will make a new DownloadRequestLimiter. |
| 92 // See also the initial_page_host_ logic in Observe() for | 92 // See also the initial_page_host_ logic in Observe() for |
| 93 // NOTIFICATION_NAV_ENTRY_PENDING. | 93 // NOTIFICATION_NAV_ENTRY_PENDING. |
| 94 break; | 94 break; |
| 95 default: | 95 default: |
| 96 NOTREACHED(); | 96 NOTREACHED(); |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 void DownloadRequestLimiter::TabDownloadState::DidGetUserGesture() { | 100 void DownloadRequestLimiter::TabDownloadState::DidGetUserInteraction( |
| 101 if (is_showing_prompt()) { | 101 const blink::WebInputEvent::Type type) { |
| 102 // Don't change the state if the user clicks on the page somewhere. | 102 if (is_showing_prompt() || type == blink::WebInputEvent::MouseWheel) { |
| 103 // Don't change the state if the user clicks on the page somewhere or has | |
| 104 // scrolled. | |
|
asanka
2016/02/22 22:16:50
It seems the code is trying to avoid changing the
dominickn
2016/02/22 23:39:26
Done.
| |
| 103 return; | 105 return; |
| 104 } | 106 } |
| 105 | 107 |
| 106 #if BUILDFLAG(ANDROID_JAVA_UI) | 108 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 107 bool promptable = InfoBarService::FromWebContents(web_contents()) != nullptr; | 109 bool promptable = InfoBarService::FromWebContents(web_contents()) != nullptr; |
| 108 #else | 110 #else |
| 109 bool promptable = | 111 bool promptable = |
| 110 PermissionBubbleManager::FromWebContents(web_contents()) != nullptr; | 112 PermissionBubbleManager::FromWebContents(web_contents()) != nullptr; |
| 111 #endif | 113 #endif |
| 112 | 114 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 487 NOTREACHED(); | 489 NOTREACHED(); |
| 488 } | 490 } |
| 489 } | 491 } |
| 490 | 492 |
| 491 void DownloadRequestLimiter::Remove(TabDownloadState* state, | 493 void DownloadRequestLimiter::Remove(TabDownloadState* state, |
| 492 content::WebContents* contents) { | 494 content::WebContents* contents) { |
| 493 DCHECK(ContainsKey(state_map_, contents)); | 495 DCHECK(ContainsKey(state_map_, contents)); |
| 494 state_map_.erase(contents); | 496 state_map_.erase(contents); |
| 495 delete state; | 497 delete state; |
| 496 } | 498 } |
| OLD | NEW |