| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/geolocation/chrome_geolocation_permission_context.h" | 5 #include "chrome/browser/geolocation/chrome_geolocation_permission_context.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 // A map between renderer child id and a pair represending the bridge id and | 132 // A map between renderer child id and a pair represending the bridge id and |
| 133 // whether the requested permission was allowed. | 133 // whether the requested permission was allowed. |
| 134 base::hash_map<int, std::pair<int, bool> > responses_; | 134 base::hash_map<int, std::pair<int, bool> > responses_; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 PermissionRequestID GeolocationPermissionContextTests::RequestID( | 137 PermissionRequestID GeolocationPermissionContextTests::RequestID( |
| 138 int bridge_id) { | 138 int bridge_id) { |
| 139 return PermissionRequestID( | 139 return PermissionRequestID( |
| 140 web_contents()->GetRenderProcessHost()->GetID(), | 140 web_contents()->GetRenderProcessHost()->GetID(), |
| 141 web_contents()->GetRenderViewHost()->GetRoutingID(), | 141 web_contents()->GetRenderViewHost()->GetRoutingID(), |
| 142 bridge_id); | 142 bridge_id, |
| 143 0); |
| 143 } | 144 } |
| 144 | 145 |
| 145 PermissionRequestID GeolocationPermissionContextTests::RequestIDForTab( | 146 PermissionRequestID GeolocationPermissionContextTests::RequestIDForTab( |
| 146 int tab, | 147 int tab, |
| 147 int bridge_id) { | 148 int bridge_id) { |
| 148 return PermissionRequestID( | 149 return PermissionRequestID( |
| 149 extra_tabs_[tab]->GetRenderProcessHost()->GetID(), | 150 extra_tabs_[tab]->GetRenderProcessHost()->GetID(), |
| 150 extra_tabs_[tab]->GetRenderViewHost()->GetRoutingID(), | 151 extra_tabs_[tab]->GetRenderViewHost()->GetRoutingID(), |
| 151 bridge_id); | 152 bridge_id, |
| 153 0); |
| 152 } | 154 } |
| 153 | 155 |
| 154 void GeolocationPermissionContextTests::RequestGeolocationPermission( | 156 void GeolocationPermissionContextTests::RequestGeolocationPermission( |
| 155 const PermissionRequestID& id, | 157 const PermissionRequestID& id, |
| 156 const GURL& requesting_frame) { | 158 const GURL& requesting_frame) { |
| 157 geolocation_permission_context_->RequestGeolocationPermission( | 159 geolocation_permission_context_->RequestGeolocationPermission( |
| 158 id.render_process_id(), id.render_view_id(), id.bridge_id(), | 160 id.render_process_id(), id.render_view_id(), id.bridge_id(), |
| 159 requesting_frame, | 161 requesting_frame, |
| 160 base::Bind(&GeolocationPermissionContextTests::PermissionResponse, | 162 base::Bind(&GeolocationPermissionContextTests::PermissionResponse, |
| 161 base::Unretained(this), id)); | 163 base::Unretained(this), id)); |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 content::LoadCommittedDetails details; | 670 content::LoadCommittedDetails details; |
| 669 details.entry = web_contents()->GetController().GetLastCommittedEntry(); | 671 details.entry = web_contents()->GetController().GetLastCommittedEntry(); |
| 670 EXPECT_FALSE(infobar_delegate->ShouldExpire(details)); | 672 EXPECT_FALSE(infobar_delegate->ShouldExpire(details)); |
| 671 // Ensure the infobar will expire when we commit the pending navigation. | 673 // Ensure the infobar will expire when we commit the pending navigation. |
| 672 details.entry = web_contents()->GetController().GetActiveEntry(); | 674 details.entry = web_contents()->GetController().GetActiveEntry(); |
| 673 EXPECT_TRUE(infobar_delegate->ShouldExpire(details)); | 675 EXPECT_TRUE(infobar_delegate->ShouldExpire(details)); |
| 674 | 676 |
| 675 // Delete the tab contents. | 677 // Delete the tab contents. |
| 676 DeleteContents(); | 678 DeleteContents(); |
| 677 } | 679 } |
| OLD | NEW |