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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "chrome/browser/app_mode/app_mode_utils.h" | 9 #include "chrome/browser/app_mode/app_mode_utils.h" |
10 #include "chrome/browser/apps/scoped_keep_alive.h" | 10 #include "chrome/browser/apps/scoped_keep_alive.h" |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 content::WebContents* ChromeAppDelegate::OpenURLFromTab( | 212 content::WebContents* ChromeAppDelegate::OpenURLFromTab( |
213 content::BrowserContext* context, | 213 content::BrowserContext* context, |
214 content::WebContents* source, | 214 content::WebContents* source, |
215 const content::OpenURLParams& params) { | 215 const content::OpenURLParams& params) { |
216 return OpenURLFromTabInternal(context, params); | 216 return OpenURLFromTabInternal(context, params); |
217 } | 217 } |
218 | 218 |
219 void ChromeAppDelegate::AddNewContents(content::BrowserContext* context, | 219 void ChromeAppDelegate::AddNewContents(content::BrowserContext* context, |
220 content::WebContents* new_contents, | 220 content::WebContents* new_contents, |
221 WindowOpenDisposition disposition, | 221 WindowOpenDisposition disposition, |
222 const gfx::Rect& initial_pos, | 222 const gfx::Rect& initial_rect, |
223 bool user_gesture, | 223 bool user_gesture, |
224 bool* was_blocked) { | 224 bool* was_blocked) { |
225 if (!disable_external_open_for_testing_) { | 225 if (!disable_external_open_for_testing_) { |
226 // We don't really want to open a window for |new_contents|, but we need to | 226 // We don't really want to open a window for |new_contents|, but we need to |
227 // capture its intended navigation. Here we give ownership to the | 227 // capture its intended navigation. Here we give ownership to the |
228 // NewWindowContentsDelegate, which will dispose of the contents once | 228 // NewWindowContentsDelegate, which will dispose of the contents once |
229 // a navigation is captured. | 229 // a navigation is captured. |
230 new_contents->SetDelegate(new_window_contents_delegate_.get()); | 230 new_contents->SetDelegate(new_window_contents_delegate_.get()); |
231 return; | 231 return; |
232 } | 232 } |
233 chrome::ScopedTabbedBrowserDisplayer displayer( | 233 chrome::ScopedTabbedBrowserDisplayer displayer( |
234 Profile::FromBrowserContext(context), chrome::GetActiveDesktop()); | 234 Profile::FromBrowserContext(context), chrome::GetActiveDesktop()); |
235 // Force all links to open in a new tab, even if they were trying to open a | 235 // Force all links to open in a new tab, even if they were trying to open a |
236 // new window. | 236 // new window. |
237 disposition = | 237 disposition = |
238 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; | 238 disposition == NEW_BACKGROUND_TAB ? disposition : NEW_FOREGROUND_TAB; |
239 chrome::AddWebContents(displayer.browser(), | 239 chrome::AddWebContents(displayer.browser(), |
240 NULL, | 240 NULL, |
241 new_contents, | 241 new_contents, |
242 disposition, | 242 disposition, |
243 initial_pos, | 243 initial_rect, |
244 user_gesture, | 244 user_gesture, |
245 was_blocked); | 245 was_blocked); |
246 } | 246 } |
247 | 247 |
248 content::ColorChooser* ChromeAppDelegate::ShowColorChooser( | 248 content::ColorChooser* ChromeAppDelegate::ShowColorChooser( |
249 content::WebContents* web_contents, | 249 content::WebContents* web_contents, |
250 SkColor initial_color) { | 250 SkColor initial_color) { |
251 return chrome::ShowColorChooser(web_contents, initial_color); | 251 return chrome::ShowColorChooser(web_contents, initial_color); |
252 } | 252 } |
253 | 253 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 const content::NotificationDetails& details) { | 309 const content::NotificationDetails& details) { |
310 switch (type) { | 310 switch (type) { |
311 case chrome::NOTIFICATION_APP_TERMINATING: | 311 case chrome::NOTIFICATION_APP_TERMINATING: |
312 if (!terminating_callback_.is_null()) | 312 if (!terminating_callback_.is_null()) |
313 terminating_callback_.Run(); | 313 terminating_callback_.Run(); |
314 break; | 314 break; |
315 default: | 315 default: |
316 NOTREACHED() << "Received unexpected notification"; | 316 NOTREACHED() << "Received unexpected notification"; |
317 } | 317 } |
318 } | 318 } |
OLD | NEW |