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 "content/browser/tab_contents/tab_contents.h" | 5 #include "content/browser/tab_contents/tab_contents.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 #endif | 255 #endif |
256 is_showing_before_unload_dialog_(false), | 256 is_showing_before_unload_dialog_(false), |
257 opener_web_ui_type_(WebUI::kNoWebUI), | 257 opener_web_ui_type_(WebUI::kNoWebUI), |
258 closed_by_user_gesture_(false), | 258 closed_by_user_gesture_(false), |
259 minimum_zoom_percent_( | 259 minimum_zoom_percent_( |
260 static_cast<int>(content::kMinimumZoomFactor * 100)), | 260 static_cast<int>(content::kMinimumZoomFactor * 100)), |
261 maximum_zoom_percent_( | 261 maximum_zoom_percent_( |
262 static_cast<int>(content::kMaximumZoomFactor * 100)), | 262 static_cast<int>(content::kMaximumZoomFactor * 100)), |
263 temporary_zoom_settings_(false), | 263 temporary_zoom_settings_(false), |
264 content_restrictions_(0), | 264 content_restrictions_(0), |
265 view_type_(content::VIEW_TYPE_TAB_CONTENTS) { | 265 view_type_(content::VIEW_TYPE_TAB_CONTENTS), |
| 266 has_opener_(false) { |
266 render_manager_.Init(browser_context, site_instance, routing_id); | 267 render_manager_.Init(browser_context, site_instance, routing_id); |
267 | 268 |
268 // We have the initial size of the view be based on the size of the passed in | 269 // We have the initial size of the view be based on the size of the passed in |
269 // tab contents (normally a tab from the same window). | 270 // tab contents (normally a tab from the same window). |
270 view_->CreateView(base_tab_contents ? | 271 view_->CreateView(base_tab_contents ? |
271 base_tab_contents->GetView()->GetContainerSize() : gfx::Size()); | 272 base_tab_contents->GetView()->GetContainerSize() : gfx::Size()); |
272 | 273 |
273 #if defined(ENABLE_JAVA_BRIDGE) | 274 #if defined(ENABLE_JAVA_BRIDGE) |
274 java_bridge_dispatcher_host_manager_.reset( | 275 java_bridge_dispatcher_host_manager_.reset( |
275 new JavaBridgeDispatcherHostManager(this)); | 276 new JavaBridgeDispatcherHostManager(this)); |
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 render_manager_.pending_web_ui())) | 1342 render_manager_.pending_web_ui())) |
1342 return render_manager_.pending_web_ui(); | 1343 return render_manager_.pending_web_ui(); |
1343 return render_manager_.web_ui(); | 1344 return render_manager_.web_ui(); |
1344 } | 1345 } |
1345 | 1346 |
1346 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { | 1347 bool TabContents::GotResponseToLockMouseRequest(bool allowed) { |
1347 return GetRenderViewHost() ? | 1348 return GetRenderViewHost() ? |
1348 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; | 1349 GetRenderViewHostImpl()->GotResponseToLockMouseRequest(allowed) : false; |
1349 } | 1350 } |
1350 | 1351 |
| 1352 bool TabContents::HasOpener() const { |
| 1353 return has_opener_; |
| 1354 } |
| 1355 |
1351 bool TabContents::FocusLocationBarByDefault() { | 1356 bool TabContents::FocusLocationBarByDefault() { |
1352 content::WebUI* web_ui = GetWebUIForCurrentState(); | 1357 content::WebUI* web_ui = GetWebUIForCurrentState(); |
1353 if (web_ui) | 1358 if (web_ui) |
1354 return web_ui->ShouldFocusLocationBarByDefault(); | 1359 return web_ui->ShouldFocusLocationBarByDefault(); |
1355 NavigationEntry* entry = controller_.GetActiveEntry(); | 1360 NavigationEntry* entry = controller_.GetActiveEntry(); |
1356 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) | 1361 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) |
1357 return true; | 1362 return true; |
1358 return false; | 1363 return false; |
1359 } | 1364 } |
1360 | 1365 |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2507 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2512 void TabContents::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2508 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2513 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2509 // Can be NULL during tests. | 2514 // Can be NULL during tests. |
2510 if (rwh_view) | 2515 if (rwh_view) |
2511 rwh_view->SetSize(GetView()->GetContainerSize()); | 2516 rwh_view->SetSize(GetView()->GetContainerSize()); |
2512 } | 2517 } |
2513 | 2518 |
2514 RenderViewHostImpl* TabContents::GetRenderViewHostImpl() { | 2519 RenderViewHostImpl* TabContents::GetRenderViewHostImpl() { |
2515 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2520 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2516 } | 2521 } |
OLD | NEW |