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 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1248 WebContents* source = download->GetWebContents(); | 1248 WebContents* source = download->GetWebContents(); |
1249 if (source && source->GetController().IsInitialNavigation() && | 1249 if (source && source->GetController().IsInitialNavigation() && |
1250 tab_strip_model_->count() > 1 && !download->IsSavePackageDownload()) { | 1250 tab_strip_model_->count() > 1 && !download->IsSavePackageDownload()) { |
1251 CloseContents(source); | 1251 CloseContents(source); |
1252 } | 1252 } |
1253 | 1253 |
1254 // Some (app downloads) are not supposed to appear on the shelf. | 1254 // Some (app downloads) are not supposed to appear on the shelf. |
1255 if (!DownloadItemModel(download).ShouldShowInShelf()) | 1255 if (!DownloadItemModel(download).ShouldShowInShelf()) |
1256 return; | 1256 return; |
1257 | 1257 |
1258 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
asanka
2013/07/24 20:09:57
Nit: Check this before the ShowShowInShelf() test
| |
1259 switches::kDisableDownloadShelf)) | |
1260 return; | |
1261 | |
1258 // GetDownloadShelf creates the download shelf if it was not yet created. | 1262 // GetDownloadShelf creates the download shelf if it was not yet created. |
1259 DownloadShelf* shelf = window()->GetDownloadShelf(); | 1263 DownloadShelf* shelf = window()->GetDownloadShelf(); |
1260 shelf->AddDownload(download); | 1264 shelf->AddDownload(download); |
1261 } | 1265 } |
1262 | 1266 |
1263 /////////////////////////////////////////////////////////////////////////////// | 1267 /////////////////////////////////////////////////////////////////////////////// |
1264 // Browser, content::WebContentsDelegate implementation: | 1268 // Browser, content::WebContentsDelegate implementation: |
1265 | 1269 |
1266 WebContents* Browser::OpenURLFromTab(WebContents* source, | 1270 WebContents* Browser::OpenURLFromTab(WebContents* source, |
1267 const OpenURLParams& params) { | 1271 const OpenURLParams& params) { |
(...skipping 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2280 if (contents && !allow_js_access) { | 2284 if (contents && !allow_js_access) { |
2281 contents->web_contents()->GetController().LoadURL( | 2285 contents->web_contents()->GetController().LoadURL( |
2282 target_url, | 2286 target_url, |
2283 content::Referrer(), | 2287 content::Referrer(), |
2284 content::PAGE_TRANSITION_LINK, | 2288 content::PAGE_TRANSITION_LINK, |
2285 std::string()); // No extra headers. | 2289 std::string()); // No extra headers. |
2286 } | 2290 } |
2287 | 2291 |
2288 return contents != NULL; | 2292 return contents != NULL; |
2289 } | 2293 } |
OLD | NEW |