OLD | NEW |
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/network_profile_bubble_view.h" | 5 #include "chrome/browser/ui/views/network_profile_bubble_view.h" |
6 | 6 |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
10 #include "chrome/browser/ui/network_profile_bubble.h" | 10 #include "chrome/browser/ui/network_profile_bubble.h" |
11 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
12 #include "chrome/browser/ui/views/toolbar_view.h" | 12 #include "chrome/browser/ui/views/toolbar_view.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "grit/chromium_strings.h" | 14 #include "grit/chromium_strings.h" |
15 #include "grit/generated_resources.h" | 15 #include "grit/generated_resources.h" |
16 #include "ui/base/l10n/l10n_util.h" | 16 #include "ui/base/l10n/l10n_util.h" |
| 17 #include "ui/views/controls/button/label_button.h" |
17 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
18 #include "ui/views/controls/link.h" | 19 #include "ui/views/controls/link.h" |
19 #include "ui/views/layout/grid_layout.h" | 20 #include "ui/views/layout/grid_layout.h" |
20 #include "ui/views/layout/layout_constants.h" | 21 #include "ui/views/layout/layout_constants.h" |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 // Bubble layout constants. | 25 // Bubble layout constants. |
25 const int kAnchorVerticalInset = 5; | 26 const int kAnchorVerticalInset = 5; |
26 const int kInset = 2; | 27 const int kInset = 2; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 bottom_columns->AddColumn(views::GridLayout::CENTER, | 97 bottom_columns->AddColumn(views::GridLayout::CENTER, |
97 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); | 98 views::GridLayout::CENTER, 0, views::GridLayout::USE_PREF, 0, 0); |
98 layout->StartRowWithPadding(0, 1, 0, | 99 layout->StartRowWithPadding(0, 1, 0, |
99 views::kRelatedControlSmallVerticalSpacing); | 100 views::kRelatedControlSmallVerticalSpacing); |
100 | 101 |
101 views::Link* learn_more = | 102 views::Link* learn_more = |
102 new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 103 new views::Link(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
103 learn_more->set_listener(this); | 104 learn_more->set_listener(this); |
104 layout->AddView(learn_more); | 105 layout->AddView(learn_more); |
105 | 106 |
106 views::NativeTextButton* ok_button = new views::NativeTextButton( | 107 views::LabelButton* ok_button = new views::LabelButton( |
107 this, l10n_util::GetStringUTF16(IDS_OK)); | 108 this, l10n_util::GetStringUTF16(IDS_OK)); |
| 109 ok_button->SetStyle(views::Button::STYLE_NATIVE_TEXTBUTTON); |
108 ok_button->SetIsDefault(true); | 110 ok_button->SetIsDefault(true); |
109 layout->AddView(ok_button); | 111 layout->AddView(ok_button); |
110 } | 112 } |
111 | 113 |
112 void NetworkProfileBubbleView::ButtonPressed(views::Button* sender, | 114 void NetworkProfileBubbleView::ButtonPressed(views::Button* sender, |
113 const ui::Event& event) { | 115 const ui::Event& event) { |
114 NetworkProfileBubble::RecordUmaEvent( | 116 NetworkProfileBubble::RecordUmaEvent( |
115 NetworkProfileBubble::METRIC_ACKNOWLEDGED); | 117 NetworkProfileBubble::METRIC_ACKNOWLEDGED); |
116 | 118 |
117 GetWidget()->Close(); | 119 GetWidget()->Close(); |
(...skipping 13 matching lines...) Expand all Loading... |
131 content::PAGE_TRANSITION_LINK, false); | 133 content::PAGE_TRANSITION_LINK, false); |
132 navigator_->OpenURL(params); | 134 navigator_->OpenURL(params); |
133 | 135 |
134 // If the user interacted with the bubble we don't reduce the number of | 136 // If the user interacted with the bubble we don't reduce the number of |
135 // warnings left. | 137 // warnings left. |
136 PrefService* prefs = profile_->GetPrefs(); | 138 PrefService* prefs = profile_->GetPrefs(); |
137 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); | 139 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); |
138 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings); | 140 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings); |
139 GetWidget()->Close(); | 141 GetWidget()->Close(); |
140 } | 142 } |
OLD | NEW |