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

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

Issue 8863009: Fix alignment of avatar bubbles in the NTP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use Rect::Ofset() Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/first_run_bubble.h" 5 #include "chrome/browser/ui/views/first_run_bubble.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/first_run/first_run.h" 9 #include "chrome/browser/first_run/first_run.h"
10 #include "chrome/browser/search_engines/util.h" 10 #include "chrome/browser/search_engines/util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 layout->StartRow(0, 0); 90 layout->StartRow(0, 0);
91 layout->AddView(label1); 91 layout->AddView(label1);
92 layout->AddView(close_button, 1, 1, views::GridLayout::TRAILING, 92 layout->AddView(close_button, 1, 1, views::GridLayout::TRAILING,
93 views::GridLayout::LEADING); 93 views::GridLayout::LEADING);
94 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); 94 layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing);
95 95
96 layout->StartRow(0, 0); 96 layout->StartRow(0, 0);
97 layout->AddView(label2); 97 layout->AddView(label2);
98 } 98 }
99 99
100 gfx::Point FirstRunBubble::GetAnchorPoint() { 100 gfx::Rect FirstRunBubble::GetAnchorRect() {
101 // Compensate for padding in anchor. 101 // Compensate for padding in anchor.
102 return BubbleDelegateView::GetAnchorPoint().Add( 102 gfx::Rect rect(BubbleDelegateView::GetAnchorRect());
103 gfx::Point(0, anchor_view() ? kAnchorVerticalOffset : 0)); 103 rect.Offset(0, anchor_view() ? kAnchorVerticalOffset : 0);
msw 2011/12/08 00:40:14 Please change this to: rect.Inset(0, anchor_view()
104 return rect;
104 } 105 }
105 106
106 FirstRunBubble::FirstRunBubble( 107 FirstRunBubble::FirstRunBubble(
107 Profile* profile, 108 Profile* profile,
108 views::View* anchor_view, 109 views::View* anchor_view,
109 views::BubbleBorder::ArrowLocation arrow_location, 110 views::BubbleBorder::ArrowLocation arrow_location,
110 FirstRun::BubbleType bubble_type) 111 FirstRun::BubbleType bubble_type)
111 : views::BubbleDelegateView(anchor_view, 112 : views::BubbleDelegateView(anchor_view,
112 arrow_location, 113 arrow_location,
113 SK_ColorWHITE), 114 SK_ColorWHITE),
114 profile_(profile), 115 profile_(profile),
115 bubble_type_(bubble_type) { 116 bubble_type_(bubble_type) {
116 } 117 }
117 118
118 FirstRunBubble::~FirstRunBubble() { 119 FirstRunBubble::~FirstRunBubble() {
119 } 120 }
120 121
121 void FirstRunBubble::ButtonPressed(views::Button* sender, 122 void FirstRunBubble::ButtonPressed(views::Button* sender,
122 const views::Event& event) { 123 const views::Event& event) {
123 if (bubble_type_ == FirstRun::OEM_BUBBLE) { 124 if (bubble_type_ == FirstRun::OEM_BUBBLE) {
124 UserMetrics::RecordAction( 125 UserMetrics::RecordAction(
125 UserMetricsAction("FirstRunOEMBubbleView_Clicked")); 126 UserMetricsAction("FirstRunOEMBubbleView_Clicked"));
126 } 127 }
127 GetWidget()->Close(); 128 GetWidget()->Close();
128 } 129 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698