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

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

Issue 8870003: Merge BorderContentsView into BubbleFrameView; simplify. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove allow_bubble_offscreen, simplify and update tests. 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 10 matching lines...) Expand all
21 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
22 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
23 #include "ui/views/controls/button/image_button.h" 23 #include "ui/views/controls/button/image_button.h"
24 #include "ui/views/controls/label.h" 24 #include "ui/views/controls/label.h"
25 #include "ui/views/events/event.h" 25 #include "ui/views/events/event.h"
26 #include "ui/views/layout/grid_layout.h" 26 #include "ui/views/layout/grid_layout.h"
27 #include "ui/views/layout/layout_constants.h" 27 #include "ui/views/layout/layout_constants.h"
28 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
29 29
30 namespace { 30 namespace {
31 const int kAnchorVerticalOffset = -4; 31 const int kAnchorVerticalInset = 5;
32 const int kLayoutTopInset = 1; 32 const int kLayoutTopInset = 1;
33 const int kLayoutLeftInset = 2; 33 const int kLayoutLeftInset = 2;
34 const int kLayoutBottomInset = 7; 34 const int kLayoutBottomInset = 7;
35 const int kLayoutRightInset = 2; 35 const int kLayoutRightInset = 2;
36 } 36 }
37 37
38 // static 38 // static
39 FirstRunBubble* FirstRunBubble::ShowBubble( 39 FirstRunBubble* FirstRunBubble::ShowBubble(
40 Profile* profile, 40 Profile* profile,
41 views::View* anchor_view, 41 views::View* anchor_view,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::Rect FirstRunBubble::GetAnchorRect() { 100 gfx::Rect FirstRunBubble::GetAnchorRect() {
101 // Compensate for padding in anchor. 101 // Compensate for padding in anchor.
102 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); 102 gfx::Rect rect(BubbleDelegateView::GetAnchorRect());
103 rect.Offset(0, anchor_view() ? kAnchorVerticalOffset : 0); 103 rect.Inset(0, anchor_view() ? kAnchorVerticalInset : 0);
104 return rect; 104 return rect;
105 } 105 }
106 106
107 FirstRunBubble::FirstRunBubble( 107 FirstRunBubble::FirstRunBubble(
108 Profile* profile, 108 Profile* profile,
109 views::View* anchor_view, 109 views::View* anchor_view,
110 views::BubbleBorder::ArrowLocation arrow_location, 110 views::BubbleBorder::ArrowLocation arrow_location,
111 FirstRun::BubbleType bubble_type) 111 FirstRun::BubbleType bubble_type)
112 : views::BubbleDelegateView(anchor_view, arrow_location), 112 : views::BubbleDelegateView(anchor_view, arrow_location),
113 profile_(profile), 113 profile_(profile),
114 bubble_type_(bubble_type) { 114 bubble_type_(bubble_type) {
115 } 115 }
116 116
117 FirstRunBubble::~FirstRunBubble() { 117 FirstRunBubble::~FirstRunBubble() {
118 } 118 }
119 119
120 void FirstRunBubble::ButtonPressed(views::Button* sender, 120 void FirstRunBubble::ButtonPressed(views::Button* sender,
121 const views::Event& event) { 121 const views::Event& event) {
122 if (bubble_type_ == FirstRun::OEM_BUBBLE) { 122 if (bubble_type_ == FirstRun::OEM_BUBBLE) {
123 UserMetrics::RecordAction( 123 UserMetrics::RecordAction(
124 UserMetricsAction("FirstRunOEMBubbleView_Clicked")); 124 UserMetricsAction("FirstRunOEMBubbleView_Clicked"));
125 } 125 }
126 GetWidget()->Close(); 126 GetWidget()->Close();
127 } 127 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698