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

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

Issue 1392023004: Rename android only infobars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: try again Created 5 years, 2 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/content_settings/host_content_settings_map_factory.h" 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
10 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 10 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
11 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/tab_contents/tab_util.h" 13 #include "chrome/browser/tab_contents/tab_util.h"
14 #include "components/content_settings/core/browser/host_content_settings_map.h" 14 #include "components/content_settings/core/browser/host_content_settings_map.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/navigation_entry.h" 18 #include "content/public/browser/navigation_entry.h"
19 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
20 #include "content/public/browser/notification_types.h" 20 #include "content/public/browser/notification_types.h"
21 #include "content/public/browser/render_process_host.h" 21 #include "content/public/browser/render_process_host.h"
22 #include "content/public/browser/resource_dispatcher_host.h" 22 #include "content/public/browser/resource_dispatcher_host.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/browser/web_contents_delegate.h" 24 #include "content/public/browser/web_contents_delegate.h"
25 #include "url/gurl.h" 25 #include "url/gurl.h"
26 26
27 #if defined(OS_ANDROID) 27 #if defined(OS_ANDROID)
28 #include "chrome/browser/download/download_request_infobar_delegate.h" 28 #include "chrome/browser/download/download_request_infobar_delegate_android.h"
29 #else 29 #else
30 #include "chrome/browser/download/download_permission_request.h" 30 #include "chrome/browser/download/download_permission_request.h"
31 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" 31 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
32 #endif 32 #endif
33 33
34 using content::BrowserThread; 34 using content::BrowserThread;
35 using content::NavigationController; 35 using content::NavigationController;
36 using content::NavigationEntry; 36 using content::NavigationEntry;
37 37
38 // TabDownloadState ------------------------------------------------------------ 38 // TabDownloadState ------------------------------------------------------------
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 void DownloadRequestLimiter::TabDownloadState::PromptUserForDownload( 129 void DownloadRequestLimiter::TabDownloadState::PromptUserForDownload(
130 const DownloadRequestLimiter::Callback& callback) { 130 const DownloadRequestLimiter::Callback& callback) {
131 callbacks_.push_back(callback); 131 callbacks_.push_back(callback);
132 DCHECK(web_contents_); 132 DCHECK(web_contents_);
133 if (is_showing_prompt()) 133 if (is_showing_prompt())
134 return; 134 return;
135 135
136 #if defined(OS_ANDROID) 136 #if defined(OS_ANDROID)
137 DownloadRequestInfoBarDelegate::Create( 137 DownloadRequestInfoBarDelegateAndroid::Create(
138 InfoBarService::FromWebContents(web_contents_), factory_.GetWeakPtr()); 138 InfoBarService::FromWebContents(web_contents_), factory_.GetWeakPtr());
139 #else 139 #else
140 PermissionBubbleManager* bubble_manager = 140 PermissionBubbleManager* bubble_manager =
141 PermissionBubbleManager::FromWebContents(web_contents_); 141 PermissionBubbleManager::FromWebContents(web_contents_);
142 if (bubble_manager) { 142 if (bubble_manager) {
143 bubble_manager->AddRequest(new DownloadPermissionRequest( 143 bubble_manager->AddRequest(new DownloadPermissionRequest(
144 factory_.GetWeakPtr())); 144 factory_.GetWeakPtr()));
145 } else { 145 } else {
146 Cancel(); 146 Cancel();
147 } 147 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 NOTREACHED(); 443 NOTREACHED();
444 } 444 }
445 } 445 }
446 446
447 void DownloadRequestLimiter::Remove(TabDownloadState* state, 447 void DownloadRequestLimiter::Remove(TabDownloadState* state,
448 content::WebContents* contents) { 448 content::WebContents* contents) {
449 DCHECK(ContainsKey(state_map_, contents)); 449 DCHECK(ContainsKey(state_map_, contents));
450 state_map_.erase(contents); 450 state_map_.erase(contents);
451 delete state; 451 delete state;
452 } 452 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698