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

Side by Side Diff: chrome/browser/ui/views/autofill/autofill_dialog_views.cc

Issue 107623002: Use the NativeTheme to create the text color for text during the generated card animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused header. Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_types.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/autofill/autofill_dialog_views.h" 5 #include "chrome/browser/ui/views/autofill/autofill_dialog_views.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 17 matching lines...) Expand all
28 #include "content/public/browser/web_contents_view.h" 28 #include "content/public/browser/web_contents_view.h"
29 #include "grit/theme_resources.h" 29 #include "grit/theme_resources.h"
30 #include "grit/ui_resources.h" 30 #include "grit/ui_resources.h"
31 #include "third_party/skia/include/core/SkColor.h" 31 #include "third_party/skia/include/core/SkColor.h"
32 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/models/combobox_model.h" 33 #include "ui/base/models/combobox_model.h"
34 #include "ui/base/models/menu_model.h" 34 #include "ui/base/models/menu_model.h"
35 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
36 #include "ui/gfx/animation/animation_delegate.h" 36 #include "ui/gfx/animation/animation_delegate.h"
37 #include "ui/gfx/canvas.h" 37 #include "ui/gfx/canvas.h"
38 #include "ui/gfx/color_utils.h"
38 #include "ui/gfx/path.h" 39 #include "ui/gfx/path.h"
39 #include "ui/gfx/point.h" 40 #include "ui/gfx/point.h"
40 #include "ui/gfx/skia_util.h" 41 #include "ui/gfx/skia_util.h"
41 #include "ui/views/background.h" 42 #include "ui/views/background.h"
42 #include "ui/views/border.h" 43 #include "ui/views/border.h"
43 #include "ui/views/bubble/bubble_border.h" 44 #include "ui/views/bubble/bubble_border.h"
44 #include "ui/views/bubble/bubble_frame_view.h" 45 #include "ui/views/bubble/bubble_frame_view.h"
45 #include "ui/views/controls/button/blue_button.h" 46 #include "ui/views/controls/button/blue_button.h"
46 #include "ui/views/controls/button/checkbox.h" 47 #include "ui/views/controls/button/checkbox.h"
47 #include "ui/views/controls/button/label_button.h" 48 #include "ui/views/controls/button/label_button.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 if (state.image.IsEmpty()) { 584 if (state.image.IsEmpty()) {
584 SetVisible(false); 585 SetVisible(false);
585 return; 586 return;
586 } 587 }
587 588
588 image_view_->SetImage(state.image.ToImageSkia()); 589 image_view_->SetImage(state.image.ToImageSkia());
589 590
590 message_view_->SetVisible(!state.string.text.empty()); 591 message_view_->SetVisible(!state.string.text.empty());
591 message_view_->SetText(state.string.text); 592 message_view_->SetText(state.string.text);
592 message_view_->SetFont(state.string.font); 593 message_view_->SetFont(state.string.font);
593 message_view_->SetEnabledColor(state.string.text_color); 594 message_view_->SetEnabledColor(GetNativeTheme()->GetSystemColor(
595 ui::NativeTheme::kColorId_TextfieldReadOnlyColor));
596
594 message_view_->set_border( 597 message_view_->set_border(
595 views::Border::CreateEmptyBorder(kOverlayMessageVerticalPadding, 598 views::Border::CreateEmptyBorder(kOverlayMessageVerticalPadding,
596 kDialogEdgePadding, 599 kDialogEdgePadding,
597 kOverlayMessageVerticalPadding, 600 kOverlayMessageVerticalPadding,
598 kDialogEdgePadding)); 601 kDialogEdgePadding));
599 602
600 SetVisible(true); 603 SetVisible(true);
601 } 604 }
602 605
603 gfx::Insets AutofillDialogViews::OverlayView::GetInsets() const { 606 gfx::Insets AutofillDialogViews::OverlayView::GetInsets() const {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 arrow.moveTo(rect.x() - 1, y); 650 arrow.moveTo(rect.x() - 1, y);
648 arrow.rLineTo(rect.width() / 2 - arrow_half_width, 0); 651 arrow.rLineTo(rect.width() / 2 - arrow_half_width, 0);
649 arrow.rLineTo(arrow_half_width, -kArrowHeight); 652 arrow.rLineTo(arrow_half_width, -kArrowHeight);
650 arrow.rLineTo(arrow_half_width, kArrowHeight); 653 arrow.rLineTo(arrow_half_width, kArrowHeight);
651 arrow.lineTo(rect.right() + 1, y); 654 arrow.lineTo(rect.right() + 1, y);
652 arrow.lineTo(rect.right() + 1, rect.bottom() + 1); 655 arrow.lineTo(rect.right() + 1, rect.bottom() + 1);
653 arrow.lineTo(rect.x() - 1, rect.bottom() + 1); 656 arrow.lineTo(rect.x() - 1, rect.bottom() + 1);
654 arrow.close(); 657 arrow.close();
655 658
656 SkPaint paint; 659 SkPaint paint;
657 paint.setColor(kShadingColor); 660 SkColor background_color = background()->get_color();
661 int background_luminance =
662 color_utils::GetLuminanceForColor(background_color);
663 int background_alpha = static_cast<int>(
664 7 + 15 * (255 - background_luminance) / 255);
665 int subtle_border_alpha = static_cast<int>(
666 10 + 20 * (255 - background_luminance) / 255);
Evan Stade 2014/01/03 02:00:55 could you at least add some commentary to explain
Sheridan Rawlins 2014/01/04 01:58:28 Done.
667
668 paint.setColor(color_utils::BlendTowardOppositeLuminance(
669 background_color, background_alpha));
658 paint.setStyle(SkPaint::kFill_Style); 670 paint.setStyle(SkPaint::kFill_Style);
659 canvas->DrawPath(arrow, paint); 671 canvas->DrawPath(arrow, paint);
660 paint.setColor(kSubtleBorderColor); 672 paint.setColor(color_utils::BlendTowardOppositeLuminance(
673 background_color, subtle_border_alpha));
661 paint.setStyle(SkPaint::kStroke_Style); 674 paint.setStyle(SkPaint::kStroke_Style);
662 canvas->DrawPath(arrow, paint); 675 canvas->DrawPath(arrow, paint);
663 } 676 }
664 677
665 PaintChildren(canvas); 678 PaintChildren(canvas);
666 } 679 }
667 680
668 void AutofillDialogViews::OverlayView::OnNativeThemeChanged( 681 void AutofillDialogViews::OverlayView::OnNativeThemeChanged(
669 const ui::NativeTheme* theme) { 682 const ui::NativeTheme* theme) {
670 set_background(views::Background::CreateSolidBackground( 683 set_background(views::Background::CreateSolidBackground(
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section) 2467 AutofillDialogViews::DetailsGroup::DetailsGroup(DialogSection section)
2455 : section(section), 2468 : section(section),
2456 container(NULL), 2469 container(NULL),
2457 manual_input(NULL), 2470 manual_input(NULL),
2458 suggested_info(NULL), 2471 suggested_info(NULL),
2459 suggested_button(NULL) {} 2472 suggested_button(NULL) {}
2460 2473
2461 AutofillDialogViews::DetailsGroup::~DetailsGroup() {} 2474 AutofillDialogViews::DetailsGroup::~DetailsGroup() {}
2462 2475
2463 } // namespace autofill 2476 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/autofill/autofill_dialog_types.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698