| 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 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 | 26 |
| 27 requests_.push_back(request); | 27 requests_.push_back(request); |
| 28 // TODO(gbillock): do we need to make default state a request property? | 28 // TODO(gbillock): do we need to make default state a request property? |
| 29 accept_state_.push_back(true); | 29 accept_state_.push_back(true); |
| 30 | 30 |
| 31 // TODO(gbillock): need significantly more complex logic here to deal | 31 // TODO(gbillock): need significantly more complex logic here to deal |
| 32 // with various states of the manager. | 32 // with various states of the manager. |
| 33 | 33 |
| 34 if (view_ && !bubble_showing_) { | 34 if (view_ && !bubble_showing_) { |
| 35 view_->SetDelegate(this); | |
| 36 view_->Show(requests_, accept_state_, customization_mode_); | 35 view_->Show(requests_, accept_state_, customization_mode_); |
| 37 bubble_showing_ = true; | 36 bubble_showing_ = true; |
| 38 } | 37 } |
| 39 } | 38 } |
| 40 | 39 |
| 41 void PermissionBubbleManager::SetView(PermissionBubbleView* view) { | 40 void PermissionBubbleManager::SetView(PermissionBubbleView* view) { |
| 42 if (view == view_) | 41 if (view == view_) |
| 43 return; | 42 return; |
| 44 | 43 |
| 45 if (view_ != NULL) { | 44 if (view_ != NULL) { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 116 } |
| 118 | 117 |
| 119 void PermissionBubbleManager::Closing() { | 118 void PermissionBubbleManager::Closing() { |
| 120 std::vector<PermissionBubbleRequest*>::iterator di; | 119 std::vector<PermissionBubbleRequest*>::iterator di; |
| 121 for (di = requests_.begin(); di != requests_.end(); di++) | 120 for (di = requests_.begin(); di != requests_.end(); di++) |
| 122 (*di)->Cancelled(); | 121 (*di)->Cancelled(); |
| 123 FinalizeBubble(); | 122 FinalizeBubble(); |
| 124 } | 123 } |
| 125 | 124 |
| 126 void PermissionBubbleManager::FinalizeBubble() { | 125 void PermissionBubbleManager::FinalizeBubble() { |
| 127 if (view_) { | 126 if (view_) |
| 128 view_->SetDelegate(NULL); | |
| 129 view_->Hide(); | 127 view_->Hide(); |
| 130 } | 128 bubble_showing_ = false; |
| 131 | 129 |
| 132 std::vector<PermissionBubbleRequest*>::iterator di; | 130 std::vector<PermissionBubbleRequest*>::iterator di; |
| 133 for (di = requests_.begin(); di != requests_.end(); di++) | 131 for (di = requests_.begin(); di != requests_.end(); di++) |
| 134 (*di)->RequestFinished(); | 132 (*di)->RequestFinished(); |
| 135 requests_.clear(); | 133 requests_.clear(); |
| 136 accept_state_.clear(); | 134 accept_state_.clear(); |
| 137 } | 135 } |
| 138 | 136 |
| OLD | NEW |