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

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

Issue 292453009: Handles iframe permissions requests separately, in a subsequent bubble. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: unit test edit Created 6 years, 6 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
OLDNEW
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 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_
6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ 6 #define CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 virtual void SetView(PermissionBubbleView* view) OVERRIDE; 58 virtual void SetView(PermissionBubbleView* view) OVERRIDE;
59 59
60 private: 60 private:
61 friend class PermissionBubbleManagerTest; 61 friend class PermissionBubbleManagerTest;
62 friend class DownloadRequestLimiterTest; 62 friend class DownloadRequestLimiterTest;
63 friend class content::WebContentsUserData<PermissionBubbleManager>; 63 friend class content::WebContentsUserData<PermissionBubbleManager>;
64 64
65 explicit PermissionBubbleManager(content::WebContents* web_contents); 65 explicit PermissionBubbleManager(content::WebContents* web_contents);
66 66
67 // WebContentsObserver: 67 // WebContentsObserver:
68
69 // TODO(leng): Finalize policy for permission requests with iFrames.
70 // DocumentLoadedInFrame() might be needed as well.
71 virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; 68 virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE;
69 virtual void DocumentLoadedInFrame(
70 int64 frame_id,
71 content::RenderViewHost* render_view_host) OVERRIDE;
72 72
73 // If a page on which permissions requests are pending is navigated, 73 // If a page on which permissions requests are pending is navigated,
74 // they will be finalized as if canceled by the user. 74 // they will be finalized as if canceled by the user.
75 virtual void NavigationEntryCommitted( 75 virtual void NavigationEntryCommitted(
76 const content::LoadCommittedDetails& details) OVERRIDE; 76 const content::LoadCommittedDetails& details) OVERRIDE;
77 virtual void WebContentsDestroyed() OVERRIDE; 77 virtual void WebContentsDestroyed() OVERRIDE;
78 78
79 // PermissionBubbleView::Delegate: 79 // PermissionBubbleView::Delegate:
80 virtual void ToggleAccept(int request_index, bool new_value) OVERRIDE; 80 virtual void ToggleAccept(int request_index, bool new_value) OVERRIDE;
81 virtual void SetCustomizationMode() OVERRIDE; 81 virtual void SetCustomizationMode() OVERRIDE;
82 virtual void Accept() OVERRIDE; 82 virtual void Accept() OVERRIDE;
83 virtual void Deny() OVERRIDE; 83 virtual void Deny() OVERRIDE;
84 virtual void Closing() OVERRIDE; 84 virtual void Closing() OVERRIDE;
85 85
86 void ShowBubble(); 86 // Posts a task which will allow the bubble to become visible if it is needed.
87 void ScheduleShowBubble();
88
89 // Shows the bubble if it is not already visible and there are pending
90 // requests.
91 void TriggerShowBubble();
87 92
88 // Finalize the pending permissions request. 93 // Finalize the pending permissions request.
89 void FinalizeBubble(); 94 void FinalizeBubble();
90 95
91 // Cancel any pending requests. This is called if the WebContents 96 // Cancel any pending requests. This is called if the WebContents
92 // on which permissions calls are pending is destroyed or navigated away 97 // on which permissions calls are pending is destroyed or navigated away
93 // from the requesting page. 98 // from the requesting page.
94 void CancelPendingQueue(); 99 void CancelPendingQueue();
95 100
101 // Returns whether or not |request| has already been added to |queue|.
102 // |same_object| must be non-null. It will be set to true if |request|
103 // is the same object as an existing request in |queue|, false otherwise.
104 bool ExistingRequest(PermissionBubbleRequest* request,
105 const std::vector<PermissionBubbleRequest*>& queue,
106 bool* same_object);
107
108 // Returns true if |queue| contains a request which was generated by a user
109 // gesture. Returns false otherwise.
110 bool HasUserGestureRequest(
111 const std::vector<PermissionBubbleRequest*>& queue);
112
96 // Whether or not we are showing the bubble in this tab. 113 // Whether or not we are showing the bubble in this tab.
97 bool bubble_showing_; 114 bool bubble_showing_;
98 115
99 // Set to the UI surface to be used to display the permissions requests. 116 // Set to the UI surface to be used to display the permissions requests.
100 PermissionBubbleView* view_; 117 PermissionBubbleView* view_;
101 118
102 std::vector<PermissionBubbleRequest*> requests_; 119 std::vector<PermissionBubbleRequest*> requests_;
103 std::vector<PermissionBubbleRequest*> queued_requests_; 120 std::vector<PermissionBubbleRequest*> queued_requests_;
121 std::vector<PermissionBubbleRequest*> queued_frame_requests_;
104 122
105 // URL of the main frame in the WebContents to which this manager is attached. 123 // URL of the main frame in the WebContents to which this manager is attached.
106 // TODO(gbillock): if there are iframes in the page, we need to deal with it. 124 // TODO(gbillock): if there are iframes in the page, we need to deal with it.
107 GURL request_url_; 125 GURL request_url_;
108 bool request_url_has_loaded_; 126 bool request_url_has_loaded_;
109 127
110 std::vector<bool> accept_states_; 128 std::vector<bool> accept_states_;
111 bool customization_mode_; 129 bool customization_mode_;
112 130
113 base::WeakPtrFactory<PermissionBubbleManager> weak_factory_; 131 base::WeakPtrFactory<PermissionBubbleManager> weak_factory_;
114 }; 132 };
115 133
116 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ 134 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698