OLD | NEW |
---|---|
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 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1291 GlobalErrorServiceFactory::GetForProfile(profile()); | 1291 GlobalErrorServiceFactory::GetForProfile(profile()); |
1292 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); | 1292 GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); |
1293 if (error) | 1293 if (error) |
1294 error->ShowBubbleView(this); | 1294 error->ShowBubbleView(this); |
1295 } | 1295 } |
1296 | 1296 |
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) { |
sky
2014/10/20 20:20:16
How do we end up with calling into Browser with a
Matt Giuca
2014/10/21 00:22:03
It's not "a WebContents Browser doesn't know about
sky
2014/10/21 03:14:08
I'm wondering why we do anything here if this brow
Matt Giuca
2014/10/21 22:59:14
Currently, even if the browser doesn't have a tab
| |
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 WebContents* source = download->GetWebContents(); | 1307 WebContents* source = download->GetWebContents(); |
1308 if (source && source->GetController().IsInitialNavigation() && | 1308 if (source && source->GetController().IsInitialNavigation() && |
1309 tab_strip_model_->count() > 1 && !download->IsSavePackageDownload()) { | 1309 tab_strip_model_->count() > 1 && |
1310 tab_strip_model_->GetIndexOfWebContents(source) != | |
1311 TabStripModel::kNoTab && | |
1312 !download->IsSavePackageDownload()) { | |
1310 CloseContents(source); | 1313 CloseContents(source); |
1311 } | 1314 } |
1312 | 1315 |
1313 // Some (app downloads) are not supposed to appear on the shelf. | 1316 // Some (app downloads) are not supposed to appear on the shelf. |
1314 if (!DownloadItemModel(download).ShouldShowInShelf()) | 1317 if (!DownloadItemModel(download).ShouldShowInShelf()) |
1315 return; | 1318 return; |
1316 | 1319 |
1317 // GetDownloadShelf creates the download shelf if it was not yet created. | 1320 // GetDownloadShelf creates the download shelf if it was not yet created. |
1318 DownloadShelf* shelf = window()->GetDownloadShelf(); | 1321 DownloadShelf* shelf = window()->GetDownloadShelf(); |
1319 shelf->AddDownload(download); | 1322 shelf->AddDownload(download); |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2493 if (contents && !allow_js_access) { | 2496 if (contents && !allow_js_access) { |
2494 contents->web_contents()->GetController().LoadURL( | 2497 contents->web_contents()->GetController().LoadURL( |
2495 target_url, | 2498 target_url, |
2496 content::Referrer(), | 2499 content::Referrer(), |
2497 ui::PAGE_TRANSITION_LINK, | 2500 ui::PAGE_TRANSITION_LINK, |
2498 std::string()); // No extra headers. | 2501 std::string()); // No extra headers. |
2499 } | 2502 } |
2500 | 2503 |
2501 return contents != NULL; | 2504 return contents != NULL; |
2502 } | 2505 } |
OLD | NEW |