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 20 matching lines...) Expand all Loading... |
31 #include "chrome/common/extensions/chrome_extension_messages.h" | 31 #include "chrome/common/extensions/chrome_extension_messages.h" |
32 #include "components/zoom/zoom_controller.h" | 32 #include "components/zoom/zoom_controller.h" |
33 #include "content/public/browser/browser_context.h" | 33 #include "content/public/browser/browser_context.h" |
34 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/host_zoom_map.h" | 35 #include "content/public/browser/host_zoom_map.h" |
36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
37 #include "content/public/browser/render_view_host.h" | 37 #include "content/public/browser/render_view_host.h" |
38 #include "content/public/browser/web_contents.h" | 38 #include "content/public/browser/web_contents.h" |
39 #include "content/public/browser/web_contents_delegate.h" | 39 #include "content/public/browser/web_contents_delegate.h" |
40 #include "extensions/common/constants.h" | 40 #include "extensions/common/constants.h" |
| 41 #include "printing/features/features.h" |
41 | 42 |
42 #if defined(USE_ASH) | 43 #if defined(USE_ASH) |
43 #include "ash/common/shelf/shelf_constants.h" // nogncheck | 44 #include "ash/common/shelf/shelf_constants.h" // nogncheck |
44 #endif | 45 #endif |
45 | 46 |
46 #if defined(ENABLE_PRINTING) | 47 #if BUILDFLAG(ENABLE_PRINTING) |
47 #if defined(ENABLE_PRINT_PREVIEW) | 48 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
48 #include "chrome/browser/printing/print_preview_message_handler.h" | 49 #include "chrome/browser/printing/print_preview_message_handler.h" |
49 #include "chrome/browser/printing/print_view_manager.h" | 50 #include "chrome/browser/printing/print_view_manager.h" |
50 #else | 51 #else |
51 #include "chrome/browser/printing/print_view_manager_basic.h" | 52 #include "chrome/browser/printing/print_view_manager_basic.h" |
52 #endif // defined(ENABLE_PRINT_PREVIEW) | 53 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
53 #endif // defined(ENABLE_PRINTING) | 54 #endif // BUILDFLAG(ENABLE_PRINTING) |
54 | 55 |
55 namespace { | 56 namespace { |
56 | 57 |
57 // Time to wait for an app window to show before allowing Chrome to quit. | 58 // Time to wait for an app window to show before allowing Chrome to quit. |
58 int kAppWindowFirstShowTimeoutSeconds = 10; | 59 int kAppWindowFirstShowTimeoutSeconds = 10; |
59 | 60 |
60 bool disable_external_open_for_testing_ = false; | 61 bool disable_external_open_for_testing_ = false; |
61 | 62 |
62 // Opens a URL with Chromium (not external browser) with the right profile. | 63 // Opens a URL with Chromium (not external browser) with the right profile. |
63 content::WebContents* OpenURLFromTabInternal( | 64 content::WebContents* OpenURLFromTabInternal( |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 179 |
179 void ChromeAppDelegate::DisableExternalOpenForTesting() { | 180 void ChromeAppDelegate::DisableExternalOpenForTesting() { |
180 disable_external_open_for_testing_ = true; | 181 disable_external_open_for_testing_ = true; |
181 } | 182 } |
182 | 183 |
183 void ChromeAppDelegate::InitWebContents(content::WebContents* web_contents) { | 184 void ChromeAppDelegate::InitWebContents(content::WebContents* web_contents) { |
184 data_use_measurement::DataUseWebContentsObserver::CreateForWebContents( | 185 data_use_measurement::DataUseWebContentsObserver::CreateForWebContents( |
185 web_contents); | 186 web_contents); |
186 favicon::CreateContentFaviconDriverForWebContents(web_contents); | 187 favicon::CreateContentFaviconDriverForWebContents(web_contents); |
187 | 188 |
188 #if defined(ENABLE_PRINTING) | 189 #if BUILDFLAG(ENABLE_PRINTING) |
189 #if defined(ENABLE_PRINT_PREVIEW) | 190 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
190 printing::PrintViewManager::CreateForWebContents(web_contents); | 191 printing::PrintViewManager::CreateForWebContents(web_contents); |
191 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); | 192 printing::PrintPreviewMessageHandler::CreateForWebContents(web_contents); |
192 #else | 193 #else |
193 printing::PrintViewManagerBasic::CreateForWebContents(web_contents); | 194 printing::PrintViewManagerBasic::CreateForWebContents(web_contents); |
194 #endif // defined(ENABLE_PRINT_PREVIEW) | 195 #endif // BUILDFLAG(ENABLE_PRINT_PREVIEW) |
195 #endif // defined(ENABLE_PRINTING) | 196 #endif // BUILDFLAG(ENABLE_PRINTING) |
196 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( | 197 extensions::ChromeExtensionWebContentsObserver::CreateForWebContents( |
197 web_contents); | 198 web_contents); |
198 | 199 |
199 zoom::ZoomController::CreateForWebContents(web_contents); | 200 zoom::ZoomController::CreateForWebContents(web_contents); |
200 } | 201 } |
201 | 202 |
202 void ChromeAppDelegate::RenderViewCreated( | 203 void ChromeAppDelegate::RenderViewCreated( |
203 content::RenderViewHost* render_view_host) { | 204 content::RenderViewHost* render_view_host) { |
204 if (!chrome::IsRunningInForcedAppMode()) { | 205 if (!chrome::IsRunningInForcedAppMode()) { |
205 // Due to a bug in the way apps reacted to default zoom changes, some apps | 206 // Due to a bug in the way apps reacted to default zoom changes, some apps |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 KeepAliveRestartOption::DISABLED)); | 344 KeepAliveRestartOption::DISABLED)); |
344 } | 345 } |
345 | 346 |
346 void ChromeAppDelegate::Observe(int type, | 347 void ChromeAppDelegate::Observe(int type, |
347 const content::NotificationSource& source, | 348 const content::NotificationSource& source, |
348 const content::NotificationDetails& details) { | 349 const content::NotificationDetails& details) { |
349 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 350 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
350 if (!terminating_callback_.is_null()) | 351 if (!terminating_callback_.is_null()) |
351 terminating_callback_.Run(); | 352 terminating_callback_.Run(); |
352 } | 353 } |
OLD | NEW |