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

Side by Side Diff: chrome/browser/web_contents.cc

Issue 17366: Check if the delegate in WebContents::CanTerminate is valid... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/web_contents.h" 5 #include "chrome/browser/web_contents.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_version_info.h" 9 #include "base/file_version_info.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 } 1335 }
1336 1336
1337 void WebContents::OnEnterOrSpace() { 1337 void WebContents::OnEnterOrSpace() {
1338 // See comment in RenderViewHostDelegate::OnEnterOrSpace as to why we do this. 1338 // See comment in RenderViewHostDelegate::OnEnterOrSpace as to why we do this.
1339 DownloadRequestManager* drm = g_browser_process->download_request_manager(); 1339 DownloadRequestManager* drm = g_browser_process->download_request_manager();
1340 if (drm) 1340 if (drm)
1341 drm->OnUserGesture(this); 1341 drm->OnUserGesture(this);
1342 } 1342 }
1343 1343
1344 bool WebContents::CanTerminate() const { 1344 bool WebContents::CanTerminate() const {
1345 if (!delegate())
1346 return true;
1347
1345 return !delegate()->IsExternalTabContainer(); 1348 return !delegate()->IsExternalTabContainer();
1346 } 1349 }
1347 1350
1348 void WebContents::FileSelected(const std::wstring& path, void* params) { 1351 void WebContents::FileSelected(const std::wstring& path, void* params) {
1349 render_view_host()->FileSelected(path); 1352 render_view_host()->FileSelected(path);
1350 } 1353 }
1351 1354
1352 void WebContents::FileSelectionCanceled(void* params) { 1355 void WebContents::FileSelectionCanceled(void* params) {
1353 // If the user cancels choosing a file to upload we need to pass back the 1356 // If the user cancels choosing a file to upload we need to pass back the
1354 // empty string. 1357 // empty string.
1355 render_view_host()->FileSelected(std::wstring()); 1358 render_view_host()->FileSelected(std::wstring());
1356 } 1359 }
1357 1360
1358 void WebContents::BeforeUnloadFiredFromRenderManager( 1361 void WebContents::BeforeUnloadFiredFromRenderManager(
1359 bool proceed, 1362 bool proceed,
1360 bool* proceed_to_fire_unload) { 1363 bool* proceed_to_fire_unload) {
1361 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload); 1364 if (delegate())
1365 delegate()->BeforeUnloadFired(this, proceed, proceed_to_fire_unload);
1362 } 1366 }
1363 1367
1364 void WebContents::UpdateRenderViewSizeForRenderManager() { 1368 void WebContents::UpdateRenderViewSizeForRenderManager() {
1365 // TODO(brettw) this is a hack. See WebContentsView::SizeContents. 1369 // TODO(brettw) this is a hack. See WebContentsView::SizeContents.
1366 view_->SizeContents(view_->GetContainerSize()); 1370 view_->SizeContents(view_->GetContainerSize());
1367 } 1371 }
1368 1372
1369 bool WebContents::CreateRenderViewForRenderManager( 1373 bool WebContents::CreateRenderViewForRenderManager(
1370 RenderViewHost* render_view_host) { 1374 RenderViewHost* render_view_host) {
1371 RenderWidgetHostView* rvh_view = view_->CreateViewForWidget(render_view_host); 1375 RenderWidgetHostView* rvh_view = view_->CreateViewForWidget(render_view_host);
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1772 // The favicon url isn't valid. This means there really isn't a favicon, 1776 // The favicon url isn't valid. This means there really isn't a favicon,
1773 // or the favicon url wasn't obtained before the load started. This assumes 1777 // or the favicon url wasn't obtained before the load started. This assumes
1774 // the later. 1778 // the later.
1775 // TODO(sky): Need a way to set the favicon that doesn't involve generating 1779 // TODO(sky): Need a way to set the favicon that doesn't involve generating
1776 // its url. 1780 // its url.
1777 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer)); 1781 new_url->SetFavIconURL(TemplateURL::GenerateFaviconURL(params.referrer));
1778 } 1782 }
1779 new_url->set_safe_for_autoreplace(true); 1783 new_url->set_safe_for_autoreplace(true);
1780 url_model->Add(new_url); 1784 url_model->Add(new_url);
1781 } 1785 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698