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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 #if defined(USE_ASH) | 46 #if defined(USE_ASH) |
47 #include "ash/shelf/shelf_constants.h" // nogncheck | 47 #include "ash/shelf/shelf_constants.h" // nogncheck |
48 #endif | 48 #endif |
49 | 49 |
50 #if defined(OS_CHROMEOS) | 50 #if defined(OS_CHROMEOS) |
51 #include "chrome/browser/chromeos/lock_screen_apps/state_controller.h" | 51 #include "chrome/browser/chromeos/lock_screen_apps/state_controller.h" |
52 #endif | 52 #endif |
53 | 53 |
54 #if BUILDFLAG(ENABLE_PRINTING) | 54 #if BUILDFLAG(ENABLE_PRINTING) |
55 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 55 #include "chrome/browser/printing/printing_init.h" |
56 #include "chrome/browser/printing/print_preview_message_handler.h" | 56 #endif |
57 #include "chrome/browser/printing/print_view_manager.h" | |
58 #else | |
59 #include "chrome/browser/printing/print_view_manager_basic.h" | |
60 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | |
61 #endif // BUILDFLAG(ENABLE_PRINTING) | |
62 | 57 |
63 namespace { | 58 namespace { |
64 | 59 |
65 // Time to wait for an app window to show before allowing Chrome to quit. | 60 // Time to wait for an app window to show before allowing Chrome to quit. |
66 int kAppWindowFirstShowTimeoutSeconds = 10; | 61 int kAppWindowFirstShowTimeoutSeconds = 10; |
67 | 62 |
68 bool disable_external_open_for_testing_ = false; | 63 bool disable_external_open_for_testing_ = false; |
69 | 64 |
70 // Opens a URL with Chromium (not external browser) with the right profile. | 65 // Opens a URL with Chromium (not external browser) with the right profile. |
71 content::WebContents* OpenURLFromTabInternal( | 66 content::WebContents* OpenURLFromTabInternal( |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 void ChromeAppDelegate::DisableExternalOpenForTesting() { | 183 void ChromeAppDelegate::DisableExternalOpenForTesting() { |
189 disable_external_open_for_testing_ = true; | 184 disable_external_open_for_testing_ = true; |
190 } | 185 } |
191 | 186 |
192 void ChromeAppDelegate::InitWebContents(content::WebContents* web_contents) { | 187 void ChromeAppDelegate::InitWebContents(content::WebContents* web_contents) { |
193 data_use_measurement::DataUseWebContentsObserver::CreateForWebContents( | 188 data_use_measurement::DataUseWebContentsObserver::CreateForWebContents( |
194 web_contents); | 189 web_contents); |
195 favicon::CreateContentFaviconDriverForWebContents(web_contents); | 190 favicon::CreateContentFaviconDriverForWebContents(web_contents); |
196 | 191 |
197 #if BUILDFLAG(ENABLE_PRINTING) | 192 #if BUILDFLAG(ENABLE_PRINTING) |
198 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 193 printing::InitializePrinting(web_contents); |
199 printing::PrintViewManager::CreateForWebContents(web_contents); | 194 #endif |
200 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); | |
201 #else | |
202 printing::PrintViewManagerBasic::CreateForWebContents(web_contents); | |
203 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) | |
204 #endif // BUILDFLAG(ENABLE_PRINTING) | |
205 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | 195 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
206 web_contents); | 196 web_contents); |
207 | 197 |
208 zoom::ZoomController::CreateForWebContents(web_contents); | 198 zoom::ZoomController::CreateForWebContents(web_contents); |
209 } | 199 } |
210 | 200 |
211 void ChromeAppDelegate::RenderViewCreated( | 201 void ChromeAppDelegate::RenderViewCreated( |
212 content::RenderViewHost* render_view_host) { | 202 content::RenderViewHost* render_view_host) { |
213 if (!chrome::IsRunningInForcedAppMode()) { | 203 if (!chrome::IsRunningInForcedAppMode()) { |
214 // Due to a bug in the way apps reacted to default zoom changes, some apps | 204 // Due to a bug in the way apps reacted to default zoom changes, some apps |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 #endif | 355 #endif |
366 } | 356 } |
367 | 357 |
368 void ChromeAppDelegate::Observe(int type, | 358 void ChromeAppDelegate::Observe(int type, |
369 const content::NotificationSource& source, | 359 const content::NotificationSource& source, |
370 const content::NotificationDetails& details) { | 360 const content::NotificationDetails& details) { |
371 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 361 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
372 if (!terminating_callback_.is_null()) | 362 if (!terminating_callback_.is_null()) |
373 terminating_callback_.Run(); | 363 terminating_callback_.Run(); |
374 } | 364 } |
OLD | NEW |