| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::DidGetUserInteraction( | 100 void DownloadRequestLimiter::TabDownloadState::DidGetUserInteraction( |
| 101 const blink::WebInputEvent::Type type) { | 101 const blink::WebInputEvent::Type type) { |
| 102 if (is_showing_prompt() || type == blink::WebInputEvent::MouseWheel) { | 102 if (is_showing_prompt() || type == blink::WebInputEvent::GestureScrollBegin) { |
| 103 // Don't change state if a prompt is showing or if the user has scrolled. | 103 // Don't change state if a prompt is showing or if the user has scrolled. |
| 104 return; | 104 return; |
| 105 } | 105 } |
| 106 | 106 |
| 107 #if BUILDFLAG(ANDROID_JAVA_UI) | 107 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 108 bool promptable = InfoBarService::FromWebContents(web_contents()) != nullptr; | 108 bool promptable = InfoBarService::FromWebContents(web_contents()) != nullptr; |
| 109 #else | 109 #else |
| 110 bool promptable = | 110 bool promptable = |
| 111 PermissionBubbleManager::FromWebContents(web_contents()) != nullptr; | 111 PermissionBubbleManager::FromWebContents(web_contents()) != nullptr; |
| 112 #endif | 112 #endif |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 NOTREACHED(); | 488 NOTREACHED(); |
| 489 } | 489 } |
| 490 } | 490 } |
| 491 | 491 |
| 492 void DownloadRequestLimiter::Remove(TabDownloadState* state, | 492 void DownloadRequestLimiter::Remove(TabDownloadState* state, |
| 493 content::WebContents* contents) { | 493 content::WebContents* contents) { |
| 494 DCHECK(ContainsKey(state_map_, contents)); | 494 DCHECK(ContainsKey(state_map_, contents)); |
| 495 state_map_.erase(contents); | 495 state_map_.erase(contents); |
| 496 delete state; | 496 delete state; |
| 497 } | 497 } |
| OLD | NEW |