| 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 "chrome/browser/download/chrome_download_manager_delegate.h" | 5 #include "chrome/browser/download/chrome_download_manager_delegate.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 Browser* browser = | 488 Browser* browser = |
| 489 web_contents ? chrome::FindBrowserWithWebContents(web_contents) : NULL; | 489 web_contents ? chrome::FindBrowserWithWebContents(web_contents) : NULL; |
| 490 std::unique_ptr<chrome::ScopedTabbedBrowserDisplayer> browser_displayer; | 490 std::unique_ptr<chrome::ScopedTabbedBrowserDisplayer> browser_displayer; |
| 491 if (!browser || | 491 if (!browser || |
| 492 !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { | 492 !browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { |
| 493 browser_displayer.reset(new chrome::ScopedTabbedBrowserDisplayer(profile_)); | 493 browser_displayer.reset(new chrome::ScopedTabbedBrowserDisplayer(profile_)); |
| 494 browser = browser_displayer->browser(); | 494 browser = browser_displayer->browser(); |
| 495 } | 495 } |
| 496 content::OpenURLParams params( | 496 content::OpenURLParams params( |
| 497 net::FilePathToFileURL(download->GetTargetFilePath()), | 497 net::FilePathToFileURL(download->GetTargetFilePath()), |
| 498 content::Referrer(), | 498 content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, |
| 499 NEW_FOREGROUND_TAB, | 499 ui::PAGE_TRANSITION_LINK, false); |
| 500 ui::PAGE_TRANSITION_LINK, | |
| 501 false); | |
| 502 | 500 |
| 503 if (download->GetMimeType() == "application/x-x509-user-cert") | 501 if (download->GetMimeType() == "application/x-x509-user-cert") |
| 504 chrome::ShowSettingsSubPage(browser, "certificates"); | 502 chrome::ShowSettingsSubPage(browser, "certificates"); |
| 505 else | 503 else |
| 506 browser->OpenURL(params); | 504 browser->OpenURL(params); |
| 507 | 505 |
| 508 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_DEFAULT_BROWSER); | 506 RecordDownloadOpenMethod(DOWNLOAD_OPEN_METHOD_DEFAULT_BROWSER); |
| 509 #else | 507 #else |
| 510 // ShouldPreferOpeningInBrowser() should never be true on Android. | 508 // ShouldPreferOpeningInBrowser() should never be true on Android. |
| 511 NOTREACHED(); | 509 NOTREACHED(); |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || | 807 path.MatchesExtension(FILE_PATH_LITERAL(".xht")) || |
| 810 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || | 808 path.MatchesExtension(FILE_PATH_LITERAL(".xhtm")) || |
| 811 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || | 809 path.MatchesExtension(FILE_PATH_LITERAL(".xhtml")) || |
| 812 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || | 810 path.MatchesExtension(FILE_PATH_LITERAL(".xsl")) || |
| 813 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { | 811 path.MatchesExtension(FILE_PATH_LITERAL(".xslt"))) { |
| 814 return true; | 812 return true; |
| 815 } | 813 } |
| 816 #endif | 814 #endif |
| 817 return false; | 815 return false; |
| 818 } | 816 } |
| OLD | NEW |