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 "chrome/browser/prefs/pref_service.h" | 7 #include "chrome/browser/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" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 } | 108 } |
109 | 109 |
110 gfx::Rect NetworkProfileBubbleView::GetAnchorRect() { | 110 gfx::Rect NetworkProfileBubbleView::GetAnchorRect() { |
111 // Compensate for padding in anchor. | 111 // Compensate for padding in anchor. |
112 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); | 112 gfx::Rect rect(BubbleDelegateView::GetAnchorRect()); |
113 rect.Inset(0, anchor_view() ? kAnchorVerticalInset : 0); | 113 rect.Inset(0, anchor_view() ? kAnchorVerticalInset : 0); |
114 return rect; | 114 return rect; |
115 } | 115 } |
116 | 116 |
117 void NetworkProfileBubbleView::ButtonPressed(views::Button* sender, | 117 void NetworkProfileBubbleView::ButtonPressed(views::Button* sender, |
118 const views::Event& event) { | 118 const ui::Event& event) { |
119 NetworkProfileBubble::RecordUmaEvent( | 119 NetworkProfileBubble::RecordUmaEvent( |
120 NetworkProfileBubble::METRIC_ACKNOWLEDGED); | 120 NetworkProfileBubble::METRIC_ACKNOWLEDGED); |
121 | 121 |
122 GetWidget()->Close(); | 122 GetWidget()->Close(); |
123 } | 123 } |
124 | 124 |
125 void NetworkProfileBubbleView::LinkClicked(views::Link* source, | 125 void NetworkProfileBubbleView::LinkClicked(views::Link* source, |
126 int event_flags) { | 126 int event_flags) { |
127 NetworkProfileBubble::RecordUmaEvent( | 127 NetworkProfileBubble::RecordUmaEvent( |
128 NetworkProfileBubble::METRIC_LEARN_MORE_CLICKED); | 128 NetworkProfileBubble::METRIC_LEARN_MORE_CLICKED); |
129 WindowOpenDisposition disposition = | 129 WindowOpenDisposition disposition = |
130 chrome::DispositionFromEventFlags(event_flags); | 130 chrome::DispositionFromEventFlags(event_flags); |
131 content::OpenURLParams params( | 131 content::OpenURLParams params( |
132 GURL("https://sites.google.com/a/chromium.org/dev/administrators/" | 132 GURL("https://sites.google.com/a/chromium.org/dev/administrators/" |
133 "common-problems-and-solutions#network_profile"), | 133 "common-problems-and-solutions#network_profile"), |
134 content::Referrer(), | 134 content::Referrer(), |
135 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, | 135 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, |
136 content::PAGE_TRANSITION_LINK, false); | 136 content::PAGE_TRANSITION_LINK, false); |
137 navigator_->OpenURL(params); | 137 navigator_->OpenURL(params); |
138 | 138 |
139 // If the user interacted with the bubble we don't reduce the number of | 139 // If the user interacted with the bubble we don't reduce the number of |
140 // warnings left. | 140 // warnings left. |
141 PrefService* prefs = profile_->GetPrefs(); | 141 PrefService* prefs = profile_->GetPrefs(); |
142 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); | 142 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); |
143 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings); | 143 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings); |
144 GetWidget()->Close(); | 144 GetWidget()->Close(); |
145 } | 145 } |
OLD | NEW |