Chromium Code Reviews| 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 #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 Loading... | |
| 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 // If |exact_duplicate| is non-null, it will be set to true if |request| | |
| 103 // is the same object as an existing request in |queue|. | |
| 104 bool ExistingRequest(PermissionBubbleRequest* request, | |
| 105 const std::vector<PermissionBubbleRequest*>& queue, | |
| 106 bool* exact_dupcliate); | |
|
Greg Billock
2014/05/21 17:09:19
sp
leng
2014/05/22 00:08:47
Done.
| |
| 107 | |
| 96 // Whether or not we are showing the bubble in this tab. | 108 // Whether or not we are showing the bubble in this tab. |
| 97 bool bubble_showing_; | 109 bool bubble_showing_; |
| 98 | 110 |
| 99 // Set to the UI surface to be used to display the permissions requests. | 111 // Set to the UI surface to be used to display the permissions requests. |
| 100 PermissionBubbleView* view_; | 112 PermissionBubbleView* view_; |
| 101 | 113 |
| 102 std::vector<PermissionBubbleRequest*> requests_; | 114 std::vector<PermissionBubbleRequest*> requests_; |
| 103 std::vector<PermissionBubbleRequest*> queued_requests_; | 115 std::vector<PermissionBubbleRequest*> queued_requests_; |
| 116 std::vector<PermissionBubbleRequest*> queued_frame_requests_; | |
| 104 | 117 |
| 105 // URL of the main frame in the WebContents to which this manager is attached. | 118 // 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. | 119 // TODO(gbillock): if there are iframes in the page, we need to deal with it. |
| 107 GURL request_url_; | 120 GURL request_url_; |
| 108 bool request_url_has_loaded_; | 121 bool request_url_has_loaded_; |
| 109 | 122 |
| 110 std::vector<bool> accept_states_; | 123 std::vector<bool> accept_states_; |
| 111 bool customization_mode_; | 124 bool customization_mode_; |
| 112 | 125 |
| 113 base::WeakPtrFactory<PermissionBubbleManager> weak_factory_; | 126 base::WeakPtrFactory<PermissionBubbleManager> weak_factory_; |
| 114 }; | 127 }; |
| 115 | 128 |
| 116 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ | 129 #endif // CHROME_BROWSER_UI_WEBSITE_SETTINGS_PERMISSION_BUBBLE_MANAGER_H_ |
| OLD | NEW |