| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/website_settings/permission_bubble_manager.h" | 5 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/user_metrics_action.h" | 8 #include "base/metrics/user_metrics_action.h" |
| 9 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 9 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 view_ = view; | 114 view_ = view; |
| 115 if (view_) | 115 if (view_) |
| 116 view_->SetDelegate(this); | 116 view_->SetDelegate(this); |
| 117 else | 117 else |
| 118 return; | 118 return; |
| 119 | 119 |
| 120 ShowBubble(); | 120 ShowBubble(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void PermissionBubbleManager::DocumentOnLoadCompletedInMainFrame( | 123 void PermissionBubbleManager::DocumentOnLoadCompletedInMainFrame() { |
| 124 int32 page_id) { | |
| 125 request_url_has_loaded_ = true; | 124 request_url_has_loaded_ = true; |
| 126 // This is scheduled because while all calls to the browser have been | 125 // This is scheduled because while all calls to the browser have been |
| 127 // issued at DOMContentLoaded, they may be bouncing around in scheduled | 126 // issued at DOMContentLoaded, they may be bouncing around in scheduled |
| 128 // callbacks finding the UI thread still. This makes sure we allow those | 127 // callbacks finding the UI thread still. This makes sure we allow those |
| 129 // scheduled calls to AddRequest to complete before we show the page-load | 128 // scheduled calls to AddRequest to complete before we show the page-load |
| 130 // permissions bubble. | 129 // permissions bubble. |
| 131 // TODO(gbillock): make this bind safe with a weak ptr. | 130 // TODO(gbillock): make this bind safe with a weak ptr. |
| 132 content::BrowserThread::PostTask( | 131 content::BrowserThread::PostTask( |
| 133 content::BrowserThread::UI, FROM_HERE, | 132 content::BrowserThread::UI, FROM_HERE, |
| 134 base::Bind(&PermissionBubbleManager::ShowBubble, | 133 base::Bind(&PermissionBubbleManager::ShowBubble, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 } | 238 } |
| 240 | 239 |
| 241 void PermissionBubbleManager::CancelPendingQueue() { | 240 void PermissionBubbleManager::CancelPendingQueue() { |
| 242 std::vector<PermissionBubbleRequest*>::iterator requests_iter; | 241 std::vector<PermissionBubbleRequest*>::iterator requests_iter; |
| 243 for (requests_iter = queued_requests_.begin(); | 242 for (requests_iter = queued_requests_.begin(); |
| 244 requests_iter != queued_requests_.end(); | 243 requests_iter != queued_requests_.end(); |
| 245 requests_iter++) { | 244 requests_iter++) { |
| 246 (*requests_iter)->RequestFinished(); | 245 (*requests_iter)->RequestFinished(); |
| 247 } | 246 } |
| 248 } | 247 } |
| OLD | NEW |