| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_app_delegate.h" | 5 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 bool* was_blocked) { | 245 bool* was_blocked) { |
| 246 if (!disable_external_open_for_testing_) { | 246 if (!disable_external_open_for_testing_) { |
| 247 // We don't really want to open a window for |new_contents|, but we need to | 247 // We don't really want to open a window for |new_contents|, but we need to |
| 248 // capture its intended navigation. Here we give ownership to the | 248 // capture its intended navigation. Here we give ownership to the |
| 249 // NewWindowContentsDelegate, which will dispose of the contents once | 249 // NewWindowContentsDelegate, which will dispose of the contents once |
| 250 // a navigation is captured. | 250 // a navigation is captured. |
| 251 new_contents->SetDelegate(new_window_contents_delegate_.get()); | 251 new_contents->SetDelegate(new_window_contents_delegate_.get()); |
| 252 return; | 252 return; |
| 253 } | 253 } |
| 254 chrome::ScopedTabbedBrowserDisplayer displayer( | 254 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 255 Profile::FromBrowserContext(context), chrome::GetActiveDesktop()); | 255 Profile::FromBrowserContext(context)); |
| 256 // Force all links to open in a new tab, even if they were trying to open a | 256 // Force all links to open in a new tab, even if they were trying to open a |
| 257 // new window. | 257 // new window. |
| 258 disposition = | 258 disposition = |
| 259 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; | 259 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; |
| 260 chrome::AddWebContents(displayer.browser(), | 260 chrome::AddWebContents(displayer.browser(), |
| 261 NULL, | 261 NULL, |
| 262 new_contents, | 262 new_contents, |
| 263 disposition, | 263 disposition, |
| 264 initial_rect, | 264 initial_rect, |
| 265 user_gesture, | 265 user_gesture, |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 const content::NotificationDetails& details) { | 354 const content::NotificationDetails& details) { |
| 355 switch (type) { | 355 switch (type) { |
| 356 case chrome::NOTIFICATION_APP_TERMINATING: | 356 case chrome::NOTIFICATION_APP_TERMINATING: |
| 357 if (!terminating_callback_.is_null()) | 357 if (!terminating_callback_.is_null()) |
| 358 terminating_callback_.Run(); | 358 terminating_callback_.Run(); |
| 359 break; | 359 break; |
| 360 default: | 360 default: |
| 361 NOTREACHED() << "Received unexpected notification"; | 361 NOTREACHED() << "Received unexpected notification"; |
| 362 } | 362 } |
| 363 } | 363 } |
| OLD | NEW |