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

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

Issue 666803002: Fix debug-only crash installing app from app launcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Added comment explaining why we don't close contents if there is no tab. Created 6 years, 1 month 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
« 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 void Browser::ShowFirstRunBubble() { 1297 void Browser::ShowFirstRunBubble() {
1298 window()->GetLocationBar()->ShowFirstRunBubble(); 1298 window()->GetLocationBar()->ShowFirstRunBubble();
1299 } 1299 }
1300 1300
1301 void Browser::ShowDownload(content::DownloadItem* download) { 1301 void Browser::ShowDownload(content::DownloadItem* download) {
1302 if (!window()) 1302 if (!window())
1303 return; 1303 return;
1304 1304
1305 // If the download occurs in a new tab, and it's not a save page 1305 // If the download occurs in a new tab, and it's not a save page
1306 // download (started before initial navigation completed) close it. 1306 // download (started before initial navigation completed) close it.
1307 // Avoid calling CloseContents if the tab is not in this browser's tab strip
1308 // model; this can happen if the download was initiated by something internal
1309 // to Chrome, such as by the app list.
1307 WebContents* source = download->GetWebContents(); 1310 WebContents* source = download->GetWebContents();
1308 if (source && source->GetController().IsInitialNavigation() && 1311 if (source && source->GetController().IsInitialNavigation() &&
1309 tab_strip_model_->count() > 1 && !download->IsSavePackageDownload()) { 1312 tab_strip_model_->count() > 1 &&
1313 tab_strip_model_->GetIndexOfWebContents(source) !=
1314 TabStripModel::kNoTab &&
1315 !download->IsSavePackageDownload()) {
1310 CloseContents(source); 1316 CloseContents(source);
1311 } 1317 }
1312 1318
1313 // Some (app downloads) are not supposed to appear on the shelf. 1319 // Some (app downloads) are not supposed to appear on the shelf.
1314 if (!DownloadItemModel(download).ShouldShowInShelf()) 1320 if (!DownloadItemModel(download).ShouldShowInShelf())
1315 return; 1321 return;
1316 1322
1317 // GetDownloadShelf creates the download shelf if it was not yet created. 1323 // GetDownloadShelf creates the download shelf if it was not yet created.
1318 DownloadShelf* shelf = window()->GetDownloadShelf(); 1324 DownloadShelf* shelf = window()->GetDownloadShelf();
1319 shelf->AddDownload(download); 1325 shelf->AddDownload(download);
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
2495 if (contents && !allow_js_access) { 2501 if (contents && !allow_js_access) {
2496 contents->web_contents()->GetController().LoadURL( 2502 contents->web_contents()->GetController().LoadURL(
2497 target_url, 2503 target_url,
2498 content::Referrer(), 2504 content::Referrer(),
2499 ui::PAGE_TRANSITION_LINK, 2505 ui::PAGE_TRANSITION_LINK,
2500 std::string()); // No extra headers. 2506 std::string()); // No extra headers.
2501 } 2507 }
2502 2508
2503 return contents != NULL; 2509 return contents != NULL;
2504 } 2510 }
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