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

Side by Side Diff: chrome/browser/download/download_request_limiter.cc

Issue 2619603002: Remove android_java_ui as it is not used (Closed)
Patch Set: Rebase to master Created 3 years, 11 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
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/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"
11 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 11 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
12 #include "chrome/browser/infobars/infobar_service.h" 12 #include "chrome/browser/infobars/infobar_service.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/tab_contents/tab_util.h" 14 #include "chrome/browser/tab_contents/tab_util.h"
15 #include "chrome/common/features.h"
16 #include "components/content_settings/core/browser/host_content_settings_map.h" 15 #include "components/content_settings/core/browser/host_content_settings_map.h"
17 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
18 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/navigation_controller.h" 18 #include "content/public/browser/navigation_controller.h"
20 #include "content/public/browser/navigation_entry.h" 19 #include "content/public/browser/navigation_entry.h"
21 #include "content/public/browser/navigation_handle.h" 20 #include "content/public/browser/navigation_handle.h"
22 #include "content/public/browser/notification_source.h" 21 #include "content/public/browser/notification_source.h"
23 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
24 #include "content/public/browser/render_process_host.h" 23 #include "content/public/browser/render_process_host.h"
25 #include "content/public/browser/resource_dispatcher_host.h" 24 #include "content/public/browser/resource_dispatcher_host.h"
26 #include "content/public/browser/web_contents.h" 25 #include "content/public/browser/web_contents.h"
27 #include "content/public/browser/web_contents_delegate.h" 26 #include "content/public/browser/web_contents_delegate.h"
28 #include "url/gurl.h" 27 #include "url/gurl.h"
29 28
30 #if BUILDFLAG(ANDROID_JAVA_UI) 29 #if defined(OS_ANDROID)
31 #include "chrome/browser/download/download_request_infobar_delegate_android.h" 30 #include "chrome/browser/download/download_request_infobar_delegate_android.h"
32 #else 31 #else
33 #include "chrome/browser/download/download_permission_request.h" 32 #include "chrome/browser/download/download_permission_request.h"
34 #include "chrome/browser/permissions/permission_request_manager.h" 33 #include "chrome/browser/permissions/permission_request_manager.h"
35 #endif 34 #endif
36 35
37 using content::BrowserThread; 36 using content::BrowserThread;
38 using content::NavigationController; 37 using content::NavigationController;
39 using content::NavigationEntry; 38 using content::NavigationEntry;
40 39
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 123 }
125 } 124 }
126 125
127 void DownloadRequestLimiter::TabDownloadState::DidGetUserInteraction( 126 void DownloadRequestLimiter::TabDownloadState::DidGetUserInteraction(
128 const blink::WebInputEvent::Type type) { 127 const blink::WebInputEvent::Type type) {
129 if (is_showing_prompt() || type == blink::WebInputEvent::GestureScrollBegin) { 128 if (is_showing_prompt() || type == blink::WebInputEvent::GestureScrollBegin) {
130 // Don't change state if a prompt is showing or if the user has scrolled. 129 // Don't change state if a prompt is showing or if the user has scrolled.
131 return; 130 return;
132 } 131 }
133 132
134 #if BUILDFLAG(ANDROID_JAVA_UI) 133 #if defined(OS_ANDROID)
135 bool promptable = InfoBarService::FromWebContents(web_contents()) != nullptr; 134 bool promptable = InfoBarService::FromWebContents(web_contents()) != nullptr;
136 #else 135 #else
137 bool promptable = 136 bool promptable =
138 PermissionRequestManager::FromWebContents(web_contents()) != nullptr; 137 PermissionRequestManager::FromWebContents(web_contents()) != nullptr;
139 #endif 138 #endif
140 139
141 // See PromptUserForDownload(): if there's no InfoBarService, then 140 // See PromptUserForDownload(): if there's no InfoBarService, then
142 // DOWNLOADS_NOT_ALLOWED is functionally equivalent to PROMPT_BEFORE_DOWNLOAD. 141 // DOWNLOADS_NOT_ALLOWED is functionally equivalent to PROMPT_BEFORE_DOWNLOAD.
143 if ((status_ != DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS) && 142 if ((status_ != DownloadRequestLimiter::ALLOW_ALL_DOWNLOADS) &&
144 (!promptable || 143 (!promptable ||
(...skipping 13 matching lines...) Expand all
158 // WARNING: We've been deleted. 157 // WARNING: We've been deleted.
159 } 158 }
160 159
161 void DownloadRequestLimiter::TabDownloadState::PromptUserForDownload( 160 void DownloadRequestLimiter::TabDownloadState::PromptUserForDownload(
162 const DownloadRequestLimiter::Callback& callback) { 161 const DownloadRequestLimiter::Callback& callback) {
163 callbacks_.push_back(callback); 162 callbacks_.push_back(callback);
164 DCHECK(web_contents_); 163 DCHECK(web_contents_);
165 if (is_showing_prompt()) 164 if (is_showing_prompt())
166 return; 165 return;
167 166
168 #if BUILDFLAG(ANDROID_JAVA_UI) 167 #if defined(OS_ANDROID)
169 DownloadRequestInfoBarDelegateAndroid::Create( 168 DownloadRequestInfoBarDelegateAndroid::Create(
170 InfoBarService::FromWebContents(web_contents_), factory_.GetWeakPtr()); 169 InfoBarService::FromWebContents(web_contents_), factory_.GetWeakPtr());
171 #else 170 #else
172 PermissionRequestManager* permission_request_manager = 171 PermissionRequestManager* permission_request_manager =
173 PermissionRequestManager::FromWebContents(web_contents_); 172 PermissionRequestManager::FromWebContents(web_contents_);
174 if (permission_request_manager) { 173 if (permission_request_manager) {
175 permission_request_manager->AddRequest( 174 permission_request_manager->AddRequest(
176 new DownloadPermissionRequest(factory_.GetWeakPtr())); 175 new DownloadPermissionRequest(factory_.GetWeakPtr()));
177 } else { 176 } else {
178 Cancel(); 177 Cancel();
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 NOTREACHED(); 465 NOTREACHED();
467 } 466 }
468 } 467 }
469 468
470 void DownloadRequestLimiter::Remove(TabDownloadState* state, 469 void DownloadRequestLimiter::Remove(TabDownloadState* state,
471 content::WebContents* contents) { 470 content::WebContents* contents) {
472 DCHECK(base::ContainsKey(state_map_, contents)); 471 DCHECK(base::ContainsKey(state_map_, contents));
473 state_map_.erase(contents); 472 state_map_.erase(contents);
474 delete state; 473 delete state;
475 } 474 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698