| OLD | NEW |
| 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/harmony/harmony_layout_delegate.h" |
| 24 #include "chrome/grit/chrome_unscaled_resources.h" | 25 #include "chrome/grit/chrome_unscaled_resources.h" |
| 25 #include "components/prefs/pref_service.h" | 26 #include "components/prefs/pref_service.h" |
| 26 #include "components/prefs/scoped_user_pref_update.h" | 27 #include "components/prefs/scoped_user_pref_update.h" |
| 27 #include "components/version_info/version_info.h" | 28 #include "components/version_info/version_info.h" |
| 28 #include "content/public/browser/browser_thread.h" | 29 #include "content/public/browser/browser_thread.h" |
| 29 #include "content/public/browser/context_factory.h" | 30 #include "content/public/browser/context_factory.h" |
| 31 #include "ui/base/material_design/material_design_controller.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 31 #include "ui/base/ui_base_switches.h" | 33 #include "ui/base/ui_base_switches.h" |
| 32 #include "ui/display/display.h" | 34 #include "ui/display/display.h" |
| 33 #include "ui/display/screen.h" | 35 #include "ui/display/screen.h" |
| 34 #include "ui/gfx/geometry/rect.h" | 36 #include "ui/gfx/geometry/rect.h" |
| 35 #include "ui/views/controls/menu/menu_controller.h" | 37 #include "ui/views/controls/menu/menu_controller.h" |
| 36 #include "ui/views/widget/native_widget.h" | 38 #include "ui/views/widget/native_widget.h" |
| 37 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 38 | 40 |
| 39 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); | 504 base::AutoReset<bool> in_callback_setter(&in_autohide_edges_callback_, true); |
| 503 callback.Run(); | 505 callback.Run(); |
| 504 } | 506 } |
| 505 #endif | 507 #endif |
| 506 | 508 |
| 507 scoped_refptr<base::TaskRunner> | 509 scoped_refptr<base::TaskRunner> |
| 508 ChromeViewsDelegate::GetBlockingPoolTaskRunner() { | 510 ChromeViewsDelegate::GetBlockingPoolTaskRunner() { |
| 509 return content::BrowserThread::GetBlockingPool(); | 511 return content::BrowserThread::GetBlockingPool(); |
| 510 } | 512 } |
| 511 | 513 |
| 514 gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() { |
| 515 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
| 516 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit); |
| 517 return ViewsDelegate::GetDialogButtonInsets(); |
| 518 } |
| 519 |
| 520 int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() { |
| 521 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
| 522 return HarmonyLayoutDelegate::kHarmonyLayoutUnit / 2; |
| 523 return ViewsDelegate::GetDialogRelatedButtonHorizontalSpacing(); |
| 524 } |
| 525 |
| 512 #if !defined(USE_ASH) | 526 #if !defined(USE_ASH) |
| 513 views::Widget::InitParams::WindowOpacity | 527 views::Widget::InitParams::WindowOpacity |
| 514 ChromeViewsDelegate::GetOpacityForInitParams( | 528 ChromeViewsDelegate::GetOpacityForInitParams( |
| 515 const views::Widget::InitParams& params) { | 529 const views::Widget::InitParams& params) { |
| 516 return views::Widget::InitParams::OPAQUE_WINDOW; | 530 return views::Widget::InitParams::OPAQUE_WINDOW; |
| 517 } | 531 } |
| 518 #endif | 532 #endif |
| OLD | NEW |