Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: chrome/browser/ui/apps/chrome_app_delegate.cc

Issue 2724933002: Convert SetVisuallyDeemphasized IPC to mojo (Closed)
Patch Set: Addressed patch 2 comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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"
42 #include "extensions/common/mojo/app_window_handler.mojom.h"
41 #include "printing/features/features.h" 43 #include "printing/features/features.h"
44 #include "services/service_manager/public/cpp/interface_provider.h"
42 45
43 #if defined(USE_ASH) 46 #if defined(USE_ASH)
44 #include "ash/common/shelf/shelf_constants.h" // nogncheck 47 #include "ash/common/shelf/shelf_constants.h" // nogncheck
45 #endif 48 #endif
46 49
47 #if BUILDFLAG(ENABLE_PRINTING) 50 #if BUILDFLAG(ENABLE_PRINTING)
48 #if BUILDFLAG(ENABLE_PRINT_PREVIEW) 51 #if BUILDFLAG(ENABLE_PRINT_PREVIEW)
49 #include "chrome/browser/printing/print_preview_message_handler.h" 52 #include "chrome/browser/printing/print_preview_message_handler.h"
50 #include "chrome/browser/printing/print_view_manager.h" 53 #include "chrome/browser/printing/print_view_manager.h"
51 #else 54 #else
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return extension_misc::EXTENSION_ICON_SMALL; 301 return extension_misc::EXTENSION_ICON_SMALL;
299 #endif 302 #endif
300 } 303 }
301 304
302 void ChromeAppDelegate::SetWebContentsBlocked( 305 void ChromeAppDelegate::SetWebContentsBlocked(
303 content::WebContents* web_contents, 306 content::WebContents* web_contents,
304 bool blocked) { 307 bool blocked) {
305 if (!blocked) 308 if (!blocked)
306 web_contents->Focus(); 309 web_contents->Focus();
307 // RenderViewHost may be NULL during shutdown. 310 // RenderViewHost may be NULL during shutdown.
308 content::RenderViewHost* host = web_contents->GetRenderViewHost(); 311 content::RenderFrameHost* host = web_contents->GetMainFrame();
309 if (host) { 312 if (host) {
310 host->Send(new ChromeViewMsg_SetVisuallyDeemphasized(host->GetRoutingID(), 313 extensions::mojom::AppWindowHandlerPtr app_window_handler;
311 blocked)); 314 host->GetProcess()->GetRemoteInterfaces()->GetInterface(
315 &app_window_handler);
316 app_window_handler->SetVisuallyDeemphasized(blocked);
312 } 317 }
313 } 318 }
314 319
315 bool ChromeAppDelegate::IsWebContentsVisible( 320 bool ChromeAppDelegate::IsWebContentsVisible(
316 content::WebContents* web_contents) { 321 content::WebContents* web_contents) {
317 return platform_util::IsVisible(web_contents->GetNativeView()); 322 return platform_util::IsVisible(web_contents->GetNativeView());
318 } 323 }
319 324
320 void ChromeAppDelegate::SetTerminatingCallback(const base::Closure& callback) { 325 void ChromeAppDelegate::SetTerminatingCallback(const base::Closure& callback) {
321 terminating_callback_ = callback; 326 terminating_callback_ = callback;
(...skipping 22 matching lines...) Expand all
344 KeepAliveRestartOption::DISABLED)); 349 KeepAliveRestartOption::DISABLED));
345 } 350 }
346 351
347 void ChromeAppDelegate::Observe(int type, 352 void ChromeAppDelegate::Observe(int type,
348 const content::NotificationSource& source, 353 const content::NotificationSource& source,
349 const content::NotificationDetails& details) { 354 const content::NotificationDetails& details) {
350 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); 355 DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type);
351 if (!terminating_callback_.is_null()) 356 if (!terminating_callback_.is_null())
352 terminating_callback_.Run(); 357 terminating_callback_.Run();
353 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698