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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.cc

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/bookmarks/bookmark_sync_promo_view.h" 5 #include "chrome/browser/ui/views/bookmarks/bookmark_sync_promo_view.h"
6 6
7 #include "base/strings/string16.h" 7 #include "base/strings/string16.h"
8 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h" 8 #include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h"
9 #include "grit/generated_resources.h" 9 #include "grit/generated_resources.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 IDS_BOOKMARK_SYNC_PROMO_MESSAGE, 45 IDS_BOOKMARK_SYNC_PROMO_MESSAGE,
46 link_text, 46 link_text,
47 &offset); 47 &offset);
48 48
49 views::StyledLabel* promo_label = new views::StyledLabel(promo_text, this); 49 views::StyledLabel* promo_label = new views::StyledLabel(promo_text, this);
50 promo_label->SetDisplayedOnBackgroundColor(kBackgroundColor); 50 promo_label->SetDisplayedOnBackgroundColor(kBackgroundColor);
51 51
52 views::StyledLabel::RangeStyleInfo link_style = 52 views::StyledLabel::RangeStyleInfo link_style =
53 views::StyledLabel::RangeStyleInfo::CreateForLink(); 53 views::StyledLabel::RangeStyleInfo::CreateForLink();
54 link_style.font_style = gfx::Font::NORMAL; 54 link_style.font_style = gfx::Font::NORMAL;
55 promo_label->AddStyleRange(ui::Range(offset, offset + link_text.length()), 55 promo_label->AddStyleRange(gfx::Range(offset, offset + link_text.length()),
56 link_style); 56 link_style);
57 57
58 views::StyledLabel::RangeStyleInfo promo_style; 58 views::StyledLabel::RangeStyleInfo promo_style;
59 promo_style.color = kTextColor; 59 promo_style.color = kTextColor;
60 ui::Range before_link_range(0, offset); 60 gfx::Range before_link_range(0, offset);
61 if (!before_link_range.is_empty()) 61 if (!before_link_range.is_empty())
62 promo_label->AddStyleRange(before_link_range, promo_style); 62 promo_label->AddStyleRange(before_link_range, promo_style);
63 ui::Range after_link_range(offset + link_text.length(), promo_text.length()); 63 gfx::Range after_link_range(offset + link_text.length(), promo_text.length());
64 if (!after_link_range.is_empty()) 64 if (!after_link_range.is_empty())
65 promo_label->AddStyleRange(after_link_range, promo_style); 65 promo_label->AddStyleRange(after_link_range, promo_style);
66 66
67 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical, 67 views::BoxLayout* layout = new views::BoxLayout(views::BoxLayout::kVertical,
68 views::kButtonHEdgeMarginNew, 68 views::kButtonHEdgeMarginNew,
69 views::kPanelVertMargin, 69 views::kPanelVertMargin,
70 0); 70 0);
71 SetLayoutManager(layout); 71 SetLayoutManager(layout);
72 AddChildView(promo_label); 72 AddChildView(promo_label);
73 } 73 }
74 74
75 void BookmarkSyncPromoView::StyledLabelLinkClicked(const ui::Range& range, 75 void BookmarkSyncPromoView::StyledLabelLinkClicked(const gfx::Range& range,
76 int event_flags) { 76 int event_flags) {
77 delegate_->OnSignInLinkClicked(); 77 delegate_->OnSignInLinkClicked();
78 } 78 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698