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

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

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 months 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
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698