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

Side by Side Diff: chrome/browser/ui/views/chrome_views_delegate.cc

Issue 2697513008: Linux Aura: Use Aura theme on all windows when 'Use Classic theme' is used (Closed)
Patch Set: Move kThemeProfileKey into c/b/ui/views/frame/browser_view.h Created 3 years, 10 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/views/chrome_views_delegate.h" 5 #include "chrome/browser/ui/views/chrome_views_delegate.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/threading/thread_task_runner_handle.h" 15 #include "base/threading/thread_task_runner_handle.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/lifetime/keep_alive_types.h" 19 #include "chrome/browser/lifetime/keep_alive_types.h"
20 #include "chrome/browser/lifetime/scoped_keep_alive.h" 20 #include "chrome/browser/lifetime/scoped_keep_alive.h"
21 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/browser/ui/ash/ash_util.h" 22 #include "chrome/browser/ui/ash/ash_util.h"
23 #include "chrome/browser/ui/browser_window_state.h" 23 #include "chrome/browser/ui/browser_window_state.h"
24 #include "chrome/browser/ui/views/frame/browser_view.h"
24 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h" 25 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h"
25 #include "chrome/grit/chrome_unscaled_resources.h" 26 #include "chrome/grit/chrome_unscaled_resources.h"
26 #include "components/prefs/pref_service.h" 27 #include "components/prefs/pref_service.h"
27 #include "components/prefs/scoped_user_pref_update.h" 28 #include "components/prefs/scoped_user_pref_update.h"
28 #include "components/version_info/version_info.h" 29 #include "components/version_info/version_info.h"
29 #include "content/public/browser/browser_thread.h" 30 #include "content/public/browser/browser_thread.h"
30 #include "content/public/browser/context_factory.h" 31 #include "content/public/browser/context_factory.h"
31 #include "ui/base/material_design/material_design_controller.h" 32 #include "ui/base/material_design/material_design_controller.h"
32 #include "ui/base/resource/resource_bundle.h" 33 #include "ui/base/resource/resource_bundle.h"
33 #include "ui/base/ui_base_switches.h" 34 #include "ui/base/ui_base_switches.h"
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 // There may be a few remaining widgets in Chrome OS that are not top level, 440 // There may be a few remaining widgets in Chrome OS that are not top level,
440 // but have neither a context nor a parent. Provide a fallback context so 441 // but have neither a context nor a parent. Provide a fallback context so
441 // users don't crash. Developers will hit the DCHECK and should provide a 442 // users don't crash. Developers will hit the DCHECK and should provide a
442 // context. 443 // context.
443 if (params->context) 444 if (params->context)
444 params->context = params->context->GetRootWindow(); 445 params->context = params->context->GetRootWindow();
445 DCHECK(params->parent || params->context || !params->child) 446 DCHECK(params->parent || params->context || !params->child)
446 << "Please provide a parent or context for this widget."; 447 << "Please provide a parent or context for this widget.";
447 if (!params->parent && !params->context) 448 if (!params->parent && !params->context)
448 params->context = ash::Shell::GetPrimaryRootWindow(); 449 params->context = ash::Shell::GetPrimaryRootWindow();
449 #elif defined(USE_AURA) 450 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
sky 2017/02/16 22:10:32 Won't this break windows? By that I mean windows n
Tom (Use chromium acct) 2017/02/17 00:35:31 windows no longer hits this branch based on your
450 // While the majority of the time, context wasn't plumbed through due to the 451 // While the majority of the time, context wasn't plumbed through due to the
451 // existence of a global WindowParentingClient, if this window is toplevel, 452 // existence of a global WindowParentingClient, if this window is toplevel,
452 // it's possible that there is no contextual state that we can use. 453 // it's possible that there is no contextual state that we can use.
453 if (params->parent == NULL && params->context == NULL && !params->child) { 454 gfx::NativeWindow parent_or_context =
454 params->native_widget = new views::DesktopNativeWidgetAura(delegate); 455 params->parent ? params->parent : params->context;
455 } else if (use_non_toplevel_window) { 456 void* profile = nullptr;
457 const char* key = BrowserView::kThemeProfileKey;
458 if (parent_or_context)
459 profile = parent_or_context->GetNativeWindowProperty(key);
460 if ((!params->parent && !params->context && !params->child) ||
461 !use_non_toplevel_window) {
462 views::DesktopNativeWidgetAura* native_widget =
463 new views::DesktopNativeWidgetAura(delegate);
464 params->native_widget = native_widget;
465 native_widget->SetNativeWindowProperty(key, profile);
466 } else {
456 views::NativeWidgetAura* native_widget = 467 views::NativeWidgetAura* native_widget =
457 new views::NativeWidgetAura(delegate); 468 new views::NativeWidgetAura(delegate);
458 if (params->parent) {
459 Profile* parent_profile = reinterpret_cast<Profile*>(
460 params->parent->GetNativeWindowProperty(Profile::kProfileKey));
461 native_widget->SetNativeWindowProperty(Profile::kProfileKey,
462 parent_profile);
463 }
464 params->native_widget = native_widget; 469 params->native_widget = native_widget;
465 } else { 470 native_widget->SetNativeWindowProperty(key, profile);
466 params->native_widget = new views::DesktopNativeWidgetAura(delegate);
467 } 471 }
468 #endif 472 #endif
469 } 473 }
470 474
471 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 475 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
472 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { 476 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) {
473 // On Ubuntu Unity, the system always provides a title bar for maximized 477 // On Ubuntu Unity, the system always provides a title bar for maximized
474 // windows. 478 // windows.
475 views::LinuxUI* ui = views::LinuxUI::instance(); 479 views::LinuxUI* ui = views::LinuxUI::instance();
476 return maximized && ui && ui->UnityIsRunning(); 480 return maximized && ui && ui->UnityIsRunning();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN)); 581 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN));
578 } 582 }
579 583
580 #if !defined(USE_ASH) 584 #if !defined(USE_ASH)
581 views::Widget::InitParams::WindowOpacity 585 views::Widget::InitParams::WindowOpacity
582 ChromeViewsDelegate::GetOpacityForInitParams( 586 ChromeViewsDelegate::GetOpacityForInitParams(
583 const views::Widget::InitParams& params) { 587 const views::Widget::InitParams& params) {
584 return views::Widget::InitParams::OPAQUE_WINDOW; 588 return views::Widget::InitParams::OPAQUE_WINDOW;
585 } 589 }
586 #endif 590 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698