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

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

Issue 2660553005: Harmony - convert hung renderer dialog. (Closed)
Patch Set: comments 1 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/harmony/harmony_layout_delegate.h" 24 #include "chrome/browser/ui/views/harmony/harmony_layout_delegate.h"
25 #include "chrome/browser/ui/views/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"
34 #include "ui/display/display.h" 35 #include "ui/display/display.h"
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return content::BrowserThread::GetBlockingPool(); 542 return content::BrowserThread::GetBlockingPool();
542 } 543 }
543 544
544 gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() { 545 gfx::Insets ChromeViewsDelegate::GetDialogButtonInsets() {
545 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 546 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
546 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit); 547 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit);
547 return ViewsDelegate::GetDialogButtonInsets(); 548 return ViewsDelegate::GetDialogButtonInsets();
548 } 549 }
549 550
550 int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() { 551 int ChromeViewsDelegate::GetDialogRelatedButtonHorizontalSpacing() {
551 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 552 return LayoutDelegate::Get()->GetLayoutDistance(
552 return HarmonyLayoutDelegate::kHarmonyLayoutUnit / 2; 553 LayoutDelegate::LayoutDistanceType::RELATED_BUTTON_HORIZONTAL_SPACING);
Peter Kasting 2017/02/02 00:32:30 I think these two functions' changes should be lan
Bret 2017/02/03 01:47:17 Done, all merged.
553 return ViewsDelegate::GetDialogRelatedButtonHorizontalSpacing();
554 } 554 }
555 555
556 int ChromeViewsDelegate::GetDialogRelatedControlVerticalSpacing() { 556 int ChromeViewsDelegate::GetDialogRelatedControlVerticalSpacing() {
557 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 557 return LayoutDelegate::Get()->GetLayoutDistance(
558 return HarmonyLayoutDelegate::kHarmonyLayoutUnit / 2; 558 LayoutDelegate::LayoutDistanceType::RELATED_CONTROL_VERTICAL_SPACING);
559 return ViewsDelegate::GetDialogRelatedControlVerticalSpacing(); 559 }
560
561 int ChromeViewsDelegate::GetDialogButtonMinimumWidth() {
562 return LayoutDelegate::Get()->GetDialogButtonMinimumWidth();
560 } 563 }
561 564
562 gfx::Insets ChromeViewsDelegate::GetDialogFrameViewInsets() { 565 gfx::Insets ChromeViewsDelegate::GetDialogFrameViewInsets() {
563 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 566 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
564 // Titles are inset at the top and sides, but not at the bottom. 567 // Titles are inset at the top and sides, but not at the bottom.
565 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit, 568 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit,
566 HarmonyLayoutDelegate::kHarmonyLayoutUnit, 0, 569 HarmonyLayoutDelegate::kHarmonyLayoutUnit, 0,
567 HarmonyLayoutDelegate::kHarmonyLayoutUnit); 570 HarmonyLayoutDelegate::kHarmonyLayoutUnit);
568 return ViewsDelegate::GetDialogFrameViewInsets(); 571 return ViewsDelegate::GetDialogFrameViewInsets();
569 } 572 }
570 573
571 gfx::Insets ChromeViewsDelegate::GetBubbleDialogMargins() { 574 gfx::Insets ChromeViewsDelegate::GetBubbleDialogMargins() {
572 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) 575 if (ui::MaterialDesignController::IsSecondaryUiMaterial())
573 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit); 576 return gfx::Insets(HarmonyLayoutDelegate::kHarmonyLayoutUnit);
574 return ViewsDelegate::GetBubbleDialogMargins(); 577 return ViewsDelegate::GetBubbleDialogMargins();
575 } 578 }
576 579
577 #if !defined(USE_ASH) 580 #if !defined(USE_ASH)
578 views::Widget::InitParams::WindowOpacity 581 views::Widget::InitParams::WindowOpacity
579 ChromeViewsDelegate::GetOpacityForInitParams( 582 ChromeViewsDelegate::GetOpacityForInitParams(
580 const views::Widget::InitParams& params) { 583 const views::Widget::InitParams& params) {
581 return views::Widget::InitParams::OPAQUE_WINDOW; 584 return views::Widget::InitParams::OPAQUE_WINDOW;
582 } 585 }
583 #endif 586 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698