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

Unified Diff: chrome/browser/ui/website_settings/permission_bubble_manager.h

Issue 150103013: Add basic coalescing behavior to the permission bubble manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nits addressed Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/website_settings/permission_bubble_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/website_settings/permission_bubble_manager.h
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.h b/chrome/browser/ui/website_settings/permission_bubble_manager.h
index ec57e0952f3ad9151479ef7d9db05543e6ec4bcd..d18b8959f0b292924ec7268b53465960088688f0 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager.h
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h
@@ -7,6 +7,7 @@
#include <vector>
+#include "base/timer/timer.h"
#include "chrome/browser/ui/website_settings/permission_bubble_view.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
@@ -36,13 +37,19 @@ class PermissionBubbleManager
// Add a new request to the permission bubble. Ownership of the request
// remains with the caller. The caller must arrange for the request to
- // outlive the PermissionBubbleManager.
+ // outlive the PermissionBubbleManager. If a bubble is visible when this
+ // call is made, the request will be queued up and shown after the current
+ // bubble closes.
virtual void AddRequest(PermissionBubbleRequest* request);
// Set the active view for the permission bubble. If this is NULL, it
// means the permission bubble is no longer showing.
virtual void SetView(PermissionBubbleView* view);
+ protected:
+ // Sets the coalesce time interval to |interval_ms|. For testing only.
+ void SetCoalesceIntervalForTesting(int interval_ms);
+
private:
friend class PermissionBubbleManagerTest;
friend class content::WebContentsUserData<PermissionBubbleManager>;
@@ -50,6 +57,14 @@ class PermissionBubbleManager
explicit PermissionBubbleManager(content::WebContents* web_contents);
// contents::WebContentsObserver:
+ // TODO(leng): Investigate the ordering and timing of page loading and
+ // permission requests with iFrames. DocumentOnLoadCompletedInMainFrame()
+ // and DocumentLoadedInFrame() might be needed as well.
+ virtual void DidFinishLoad(
+ int64 frame_id,
+ const GURL& validated_url,
+ bool is_main_frame,
+ content::RenderViewHost* render_view_host) OVERRIDE;
virtual void WebContentsDestroyed(
content::WebContents* web_contents) OVERRIDE;
@@ -60,6 +75,9 @@ class PermissionBubbleManager
virtual void Deny() OVERRIDE;
virtual void Closing() OVERRIDE;
+ // Called when the coalescing timer is done. Presents the bubble.
+ void ShowBubble();
+
// Finalize the pending permissions request.
void FinalizeBubble();
@@ -70,8 +88,11 @@ class PermissionBubbleManager
PermissionBubbleView* view_;
std::vector<PermissionBubbleRequest*> requests_;
- std::vector<bool> accept_state_;
+ std::vector<PermissionBubbleRequest*> queued_requests_;
+ std::vector<bool> accept_states_;
bool customization_mode_;
+
+ scoped_ptr<base::Timer> timer_;
};
#endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_
« no previous file with comments | « no previous file | chrome/browser/ui/website_settings/permission_bubble_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698