| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 bool user_gesture_; | 46 bool user_gesture_; |
| 47 GURL hostname_; | 47 GURL hostname_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PermissionBubbleManager); | 52 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PermissionBubbleManager); |
| 53 | 53 |
| 54 // static | 54 // static |
| 55 bool PermissionBubbleManager::Enabled() { | 55 bool PermissionBubbleManager::Enabled() { |
| 56 if (CommandLine::ForCurrentProcess()->HasSwitch( | 56 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 57 switches::kEnablePermissionsBubbles)) | 57 switches::kEnablePermissionsBubbles)) |
| 58 return true; | 58 return true; |
| 59 | 59 |
| 60 if (CommandLine::ForCurrentProcess()->HasSwitch( | 60 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 61 switches::kDisablePermissionsBubbles)) | 61 switches::kDisablePermissionsBubbles)) |
| 62 return false; | 62 return false; |
| 63 | 63 |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| 66 | 66 |
| 67 PermissionBubbleManager::PermissionBubbleManager( | 67 PermissionBubbleManager::PermissionBubbleManager( |
| 68 content::WebContents* web_contents) | 68 content::WebContents* web_contents) |
| 69 : content::WebContentsObserver(web_contents), | 69 : content::WebContentsObserver(web_contents), |
| 70 bubble_showing_(false), | 70 bubble_showing_(false), |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 bool PermissionBubbleManager::HasUserGestureRequest( | 397 bool PermissionBubbleManager::HasUserGestureRequest( |
| 398 const std::vector<PermissionBubbleRequest*>& queue) { | 398 const std::vector<PermissionBubbleRequest*>& queue) { |
| 399 std::vector<PermissionBubbleRequest*>::const_iterator iter; | 399 std::vector<PermissionBubbleRequest*>::const_iterator iter; |
| 400 for (iter = queue.begin(); iter != queue.end(); iter++) { | 400 for (iter = queue.begin(); iter != queue.end(); iter++) { |
| 401 if ((*iter)->HasUserGesture()) | 401 if ((*iter)->HasUserGesture()) |
| 402 return true; | 402 return true; |
| 403 } | 403 } |
| 404 return false; | 404 return false; |
| 405 } | 405 } |
| 406 | 406 |
| OLD | NEW |