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 16 matching lines...) Expand all Loading... | |
27 #include "chrome/browser/ui/browser_tabstrip.h" | 27 #include "chrome/browser/ui/browser_tabstrip.h" |
28 #include "chrome/browser/ui/browser_window.h" | 28 #include "chrome/browser/ui/browser_window.h" |
29 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" | 29 #include "chrome/browser/ui/scoped_tabbed_browser_displayer.h" |
30 #include "chrome/browser/ui/web_contents_sizer.h" | 30 #include "chrome/browser/ui/web_contents_sizer.h" |
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_frame_host.h" |
38 #include "content/public/browser/render_process_host.h" | |
38 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
39 #include "content/public/browser/web_contents_delegate.h" | 40 #include "content/public/browser/web_contents_delegate.h" |
40 #include "extensions/common/constants.h" | 41 #include "extensions/common/constants.h" |
41 #include "printing/features/features.h" | 42 #include "printing/features/features.h" |
43 #include "services/service_manager/public/cpp/interface_provider.h" | |
42 | 44 |
43 #if defined(USE_ASH) | 45 #if defined(USE_ASH) |
44 #include "ash/common/shelf/shelf_constants.h" // nogncheck | 46 #include "ash/common/shelf/shelf_constants.h" // nogncheck |
45 #endif | 47 #endif |
46 | 48 |
47 #if BUILDFLAG(ENABLE_PRINTING) | 49 #if BUILDFLAG(ENABLE_PRINTING) |
48 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) | 50 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) |
49 #include "chrome/browser/printing/print_preview_message_handler.h" | 51 #include "chrome/browser/printing/print_preview_message_handler.h" |
50 #include "chrome/browser/printing/print_view_manager.h" | 52 #include "chrome/browser/printing/print_view_manager.h" |
51 #else | 53 #else |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
298 return extension_misc::EXTENSION_ICON_SMALL; | 300 return extension_misc::EXTENSION_ICON_SMALL; |
299 #endif | 301 #endif |
300 } | 302 } |
301 | 303 |
302 void ChromeAppDelegate::SetWebContentsBlocked( | 304 void ChromeAppDelegate::SetWebContentsBlocked( |
303 content::WebContents* web_contents, | 305 content::WebContents* web_contents, |
304 bool blocked) { | 306 bool blocked) { |
305 if (!blocked) | 307 if (!blocked) |
306 web_contents->Focus(); | 308 web_contents->Focus(); |
307 // RenderViewHost may be NULL during shutdown. | 309 // RenderViewHost may be NULL during shutdown. |
308 content::RenderViewHost* host = web_contents->GetRenderViewHost(); | 310 content::RenderFrameHost* host = web_contents->GetMainFrame(); |
309 if (host) { | 311 if (host) { |
310 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized(host->GetRoutingID(), | 312 host->GetProcess()->GetRemoteInterfaces()->GetInterface( |
311 blocked)); | 313 &extensions_frame_observer_); |
Devlin
2017/03/04 02:19:41
This re-gets the interface each time we send the m
catmullings
2017/03/06 21:20:40
Done.
| |
314 extensions_frame_observer_->SetVisuallyDeemphasized(blocked); | |
312 } | 315 } |
313 } | 316 } |
314 | 317 |
315 bool ChromeAppDelegate::IsWebContentsVisible( | 318 bool ChromeAppDelegate::IsWebContentsVisible( |
316 content::WebContents* web_contents) { | 319 content::WebContents* web_contents) { |
317 return platform_util::IsVisible(web_contents->GetNativeView()); | 320 return platform_util::IsVisible(web_contents->GetNativeView()); |
318 } | 321 } |
319 | 322 |
320 void ChromeAppDelegate::SetTerminatingCallback(const base::Closure& callback) { | 323 void ChromeAppDelegate::SetTerminatingCallback(const base::Closure& callback) { |
321 terminating_callback_ = callback; | 324 terminating_callback_ = callback; |
(...skipping 22 matching lines...) Expand all Loading... | |
344 KeepAliveRestartOption::DISABLED)); | 347 KeepAliveRestartOption::DISABLED)); |
345 } | 348 } |
346 | 349 |
347 void ChromeAppDelegate::Observe(int type, | 350 void ChromeAppDelegate::Observe(int type, |
348 const content::NotificationSource& source, | 351 const content::NotificationSource& source, |
349 const content::NotificationDetails& details) { | 352 const content::NotificationDetails& details) { |
350 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); | 353 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); |
351 if (!terminating_callback_.is_null()) | 354 if (!terminating_callback_.is_null()) |
352 terminating_callback_.Run(); | 355 terminating_callback_.Run(); |
353 } | 356 } |
OLD | NEW |