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