| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/apps/chrome_shell_window_delegate.h" | 5 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/favicon/favicon_tab_helper.h" | 8 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 9 #include "chrome/browser/file_select_helper.h" | 9 #include "chrome/browser/file_select_helper.h" |
| 10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 10 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return new_tab_params.target_contents; | 84 return new_tab_params.target_contents; |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ChromeShellWindowDelegate::AddNewContents( | 87 void ChromeShellWindowDelegate::AddNewContents( |
| 88 Profile* profile, | 88 Profile* profile, |
| 89 content::WebContents* new_contents, | 89 content::WebContents* new_contents, |
| 90 WindowOpenDisposition disposition, | 90 WindowOpenDisposition disposition, |
| 91 const gfx::Rect& initial_pos, | 91 const gfx::Rect& initial_pos, |
| 92 bool user_gesture, | 92 bool user_gesture, |
| 93 bool* was_blocked) { | 93 bool* was_blocked) { |
| 94 #if defined(OS_MACOSX) || defined(OS_WIN) || \ | |
| 95 (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | |
| 96 if (!disable_external_open_for_testing_) { | 94 if (!disable_external_open_for_testing_) { |
| 97 new_contents->SetDelegate(new ShellWindowLinkDelegate()); | 95 new_contents->SetDelegate(new ShellWindowLinkDelegate()); |
| 98 return; | 96 return; |
| 99 } | 97 } |
| 100 #endif | |
| 101 Browser* browser = | 98 Browser* browser = |
| 102 chrome::FindOrCreateTabbedBrowser(profile, chrome::GetActiveDesktop()); | 99 chrome::FindOrCreateTabbedBrowser(profile, chrome::GetActiveDesktop()); |
| 103 // Force all links to open in a new tab, even if they were trying to open a | 100 // Force all links to open in a new tab, even if they were trying to open a |
| 104 // new window. | 101 // new window. |
| 105 disposition = | 102 disposition = |
| 106 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; | 103 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; |
| 107 chrome::AddWebContents(browser, NULL, new_contents, disposition, initial_pos, | 104 chrome::AddWebContents(browser, NULL, new_contents, disposition, initial_pos, |
| 108 user_gesture, was_blocked); | 105 user_gesture, was_blocked); |
| 109 } | 106 } |
| 110 | 107 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 host->GetRoutingID(), blocked)); | 144 host->GetRoutingID(), blocked)); |
| 148 } | 145 } |
| 149 } | 146 } |
| 150 | 147 |
| 151 bool ChromeShellWindowDelegate::IsWebContentsVisible( | 148 bool ChromeShellWindowDelegate::IsWebContentsVisible( |
| 152 content::WebContents* web_contents) { | 149 content::WebContents* web_contents) { |
| 153 return platform_util::IsVisible(web_contents->GetView()->GetNativeView()); | 150 return platform_util::IsVisible(web_contents->GetView()->GetNativeView()); |
| 154 } | 151 } |
| 155 | 152 |
| 156 } // namespace chrome | 153 } // namespace chrome |
| OLD | NEW |