Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: chrome/browser/ui/website_settings/permission_bubble_manager.cc

Issue 121113007: [WebsiteSettings] API for permissions bubbles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
6
7 #include "chrome/browser/ui/website_settings/permission_bubble_delegate.h"
8
9 void PermissionBubbleManager::AddPermissionBubbleDelegate(
10 PermissionBubbleDelegate* delegate) {
11 RemovePermissionBubbleDelegate(delegate);
12 delegates_.push_back(delegate);
13 }
14
15 void PermissionBubbleManager::RemovePermissionBubbleDelegate(
16 PermissionBubbleDelegate* delegate) {
17 for (std::vector<PermissionBubbleDelegate*>::const_iterator i =
18 delegates_.begin();
19 i != delegates_.end(); i++) {
20 if (*i == delegate) {
21 delegates_.erase(i);
22 return;
23 }
groby-ooo-7-16 2014/01/07 00:31:17 Let's do this with STL - delegates_.erase(std::re
24 }
25 }
26
27 PermissionBubbleManager::PermissionBubbleManager(
28 content::WebContents* web_contents)
29 : content::WebContentsObserver(web_contents) {
30 }
31
32 void PermissionBubbleManager::WebContentsDestroyed(
33 content::WebContents* web_contents) {
groby-ooo-7-16 2014/01/07 00:31:17 I'm aware InfoBarService does this, but I don't th
34 // The WebContents is going away; be aggressively paranoid and delete
35 // ourselves lest other parts of the system attempt to add permission bubbles
36 // or use us otherwise during the destruction.
37 web_contents->RemoveUserData(UserDataKey());
38 // That was the equivalent of "delete this". This object is now destroyed;
39 // returning from this function is the only safe thing to do.
40 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698