| 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 "chrome/browser/ui/website_settings/permission_bubble_request.h" | 8 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 : content::WebContentsObserver(web_contents), | 83 : content::WebContentsObserver(web_contents), |
| 84 bubble_showing_(false), | 84 bubble_showing_(false), |
| 85 view_(NULL), | 85 view_(NULL), |
| 86 customization_mode_(false) { | 86 customization_mode_(false) { |
| 87 timer_.reset(new base::Timer(FROM_HERE, | 87 timer_.reset(new base::Timer(FROM_HERE, |
| 88 base::TimeDelta::FromMilliseconds(kPermissionsCoalesceIntervalMs), | 88 base::TimeDelta::FromMilliseconds(kPermissionsCoalesceIntervalMs), |
| 89 base::Bind(&PermissionBubbleManager::ShowBubble, base::Unretained(this)), | 89 base::Bind(&PermissionBubbleManager::ShowBubble, base::Unretained(this)), |
| 90 false)); | 90 false)); |
| 91 } | 91 } |
| 92 | 92 |
| 93 PermissionBubbleManager::~PermissionBubbleManager() {} | 93 PermissionBubbleManager::~PermissionBubbleManager() { |
| 94 if (view_ != NULL) { |
| 95 view_->SetDelegate(NULL); |
| 96 view_->Hide(); |
| 97 bubble_showing_ = false; |
| 98 } |
| 99 } |
| 94 | 100 |
| 95 void PermissionBubbleManager::DidFinishLoad( | 101 void PermissionBubbleManager::DidFinishLoad( |
| 96 int64 frame_id, | 102 int64 frame_id, |
| 97 const GURL& validated_url, | 103 const GURL& validated_url, |
| 98 bool is_main_frame, | 104 bool is_main_frame, |
| 99 content::RenderViewHost* render_view_host) { | 105 content::RenderViewHost* render_view_host) { |
| 100 // Allows extra time for additional requests to coalesce. | 106 // Allows extra time for additional requests to coalesce. |
| 101 if (timer_->IsRunning()) | 107 if (timer_->IsRunning()) |
| 102 timer_->Reset(); | 108 timer_->Reset(); |
| 103 } | 109 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 timer_->Reset(); | 198 timer_->Reset(); |
| 193 } | 199 } |
| 194 } | 200 } |
| 195 | 201 |
| 196 void PermissionBubbleManager::SetCoalesceIntervalForTesting(int interval_ms) { | 202 void PermissionBubbleManager::SetCoalesceIntervalForTesting(int interval_ms) { |
| 197 timer_.reset(new base::Timer(FROM_HERE, | 203 timer_.reset(new base::Timer(FROM_HERE, |
| 198 base::TimeDelta::FromMilliseconds(interval_ms), | 204 base::TimeDelta::FromMilliseconds(interval_ms), |
| 199 base::Bind(&PermissionBubbleManager::ShowBubble, base::Unretained(this)), | 205 base::Bind(&PermissionBubbleManager::ShowBubble, base::Unretained(this)), |
| 200 false)); | 206 false)); |
| 201 } | 207 } |
| OLD | NEW |