| 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 "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "chrome/browser/profiles/profile.h" | 6 #include "chrome/browser/profiles/profile.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/layout_constants.h" | 8 #include "chrome/browser/ui/layout_constants.h" |
| 9 #include "chrome/browser/ui/network_profile_bubble.h" | 9 #include "chrome/browser/ui/network_profile_bubble.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 103 } |
| 104 | 104 |
| 105 void NetworkProfileBubbleView::LinkClicked(views::Link* source, | 105 void NetworkProfileBubbleView::LinkClicked(views::Link* source, |
| 106 int event_flags) { | 106 int event_flags) { |
| 107 NetworkProfileBubble::RecordUmaEvent( | 107 NetworkProfileBubble::RecordUmaEvent( |
| 108 NetworkProfileBubble::METRIC_LEARN_MORE_CLICKED); | 108 NetworkProfileBubble::METRIC_LEARN_MORE_CLICKED); |
| 109 WindowOpenDisposition disposition = | 109 WindowOpenDisposition disposition = |
| 110 ui::DispositionFromEventFlags(event_flags); | 110 ui::DispositionFromEventFlags(event_flags); |
| 111 content::OpenURLParams params( | 111 content::OpenURLParams params( |
| 112 GURL("https://sites.google.com/a/chromium.org/dev/administrators/" | 112 GURL("https://sites.google.com/a/chromium.org/dev/administrators/" |
| 113 "common-problems-and-solutions#network_profile"), | 113 "common-problems-and-solutions#network_profile"), |
| 114 content::Referrer(), | 114 content::Referrer(), disposition == WindowOpenDisposition::CURRENT_TAB |
| 115 disposition == CURRENT_TAB ? NEW_FOREGROUND_TAB : disposition, | 115 ? WindowOpenDisposition::NEW_FOREGROUND_TAB |
| 116 : disposition, |
| 116 ui::PAGE_TRANSITION_LINK, false); | 117 ui::PAGE_TRANSITION_LINK, false); |
| 117 navigator_->OpenURL(params); | 118 navigator_->OpenURL(params); |
| 118 | 119 |
| 119 // If the user interacted with the bubble we don't reduce the number of | 120 // If the user interacted with the bubble we don't reduce the number of |
| 120 // warnings left. | 121 // warnings left. |
| 121 PrefService* prefs = profile_->GetPrefs(); | 122 PrefService* prefs = profile_->GetPrefs(); |
| 122 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); | 123 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); |
| 123 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings); | 124 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings); |
| 124 GetWidget()->Close(); | 125 GetWidget()->Close(); |
| 125 } | 126 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 140 | 141 |
| 141 // Mark the time of the last bubble and reduce the number of warnings left | 142 // Mark the time of the last bubble and reduce the number of warnings left |
| 142 // before the next silence period starts. | 143 // before the next silence period starts. |
| 143 PrefService* prefs = browser->profile()->GetPrefs(); | 144 PrefService* prefs = browser->profile()->GetPrefs(); |
| 144 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime, | 145 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime, |
| 145 base::Time::Now().ToTimeT()); | 146 base::Time::Now().ToTimeT()); |
| 146 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); | 147 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); |
| 147 if (left_warnings > 0) | 148 if (left_warnings > 0) |
| 148 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings); | 149 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings); |
| 149 } | 150 } |
| OLD | NEW |