| 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 <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/user_metrics_action.h" | 10 #include "base/metrics/user_metrics_action.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/permissions/permission_uma_util.h" |
| 12 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" | 13 #include "chrome/browser/ui/website_settings/permission_bubble_request.h" |
| 13 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 14 #include "content/public/browser/browser_thread.h" | 15 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/navigation_details.h" | 16 #include "content/public/browser/navigation_details.h" |
| 16 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| 17 #include "url/origin.h" | 18 #include "url/origin.h" |
| 18 | 19 |
| 19 #if !defined(OS_ANDROID) | 20 #if !defined(OS_ANDROID) |
| 20 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
| 21 #endif | 22 #endif |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 requests_.swap(queued_frame_requests_); | 379 requests_.swap(queued_frame_requests_); |
| 379 | 380 |
| 380 // Sets the default value for each request to be 'accept'. | 381 // Sets the default value for each request to be 'accept'. |
| 381 // TODO(leng): Currently all requests default to true. If that changes: | 382 // TODO(leng): Currently all requests default to true. If that changes: |
| 382 // a) Add additional accept_state queues to store default values. | 383 // a) Add additional accept_state queues to store default values. |
| 383 // b) Change the request API to provide the default value. | 384 // b) Change the request API to provide the default value. |
| 384 accept_states_.resize(requests_.size(), true); | 385 accept_states_.resize(requests_.size(), true); |
| 385 } | 386 } |
| 386 | 387 |
| 387 view_->Show(requests_, accept_states_); | 388 view_->Show(requests_, accept_states_); |
| 389 PermissionUmaUtil::PermissionPromptShown(requests_); |
| 388 NotifyBubbleAdded(); | 390 NotifyBubbleAdded(); |
| 389 | 391 |
| 390 // If in testing mode, automatically respond to the bubble that was shown. | 392 // If in testing mode, automatically respond to the bubble that was shown. |
| 391 if (auto_response_for_test_ != NONE) | 393 if (auto_response_for_test_ != NONE) |
| 392 DoAutoResponseForTesting(); | 394 DoAutoResponseForTesting(); |
| 393 } | 395 } |
| 394 | 396 |
| 395 void PermissionBubbleManager::FinalizeBubble() { | 397 void PermissionBubbleManager::FinalizeBubble() { |
| 396 if (view_) | 398 if (view_) |
| 397 view_->Hide(); | 399 view_->Hide(); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 case DENY_ALL: | 508 case DENY_ALL: |
| 507 Deny(); | 509 Deny(); |
| 508 break; | 510 break; |
| 509 case DISMISS: | 511 case DISMISS: |
| 510 Closing(); | 512 Closing(); |
| 511 break; | 513 break; |
| 512 case NONE: | 514 case NONE: |
| 513 NOTREACHED(); | 515 NOTREACHED(); |
| 514 } | 516 } |
| 515 } | 517 } |
| OLD | NEW |