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

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

Issue 2374253002: Fix bookmark bubble/star view highlighting for Harmony. (Closed)
Patch Set: fix tests, move bubble creation to toolbar Created 4 years, 2 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings); 124 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, ++left_warnings);
125 GetWidget()->Close(); 125 GetWidget()->Close();
126 } 126 }
127 127
128 } // namespace 128 } // namespace
129 129
130 // static 130 // static
131 void NetworkProfileBubble::ShowNotification(Browser* browser) { 131 void NetworkProfileBubble::ShowNotification(Browser* browser) {
132 views::View* anchor = NULL; 132 views::View* anchor = NULL;
133 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); 133 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
134 if (browser_view && browser_view->GetToolbarView()) 134 if (browser_view && browser_view->toolbar())
135 anchor = browser_view->GetToolbarView()->app_menu_button(); 135 anchor = browser_view->toolbar()->app_menu_button();
136 NetworkProfileBubbleView* bubble = 136 NetworkProfileBubbleView* bubble =
137 new NetworkProfileBubbleView(anchor, browser, browser->profile()); 137 new NetworkProfileBubbleView(anchor, browser, browser->profile());
138 views::BubbleDialogDelegateView::CreateBubble(bubble)->Show(); 138 views::BubbleDialogDelegateView::CreateBubble(bubble)->Show();
139 139
140 NetworkProfileBubble::SetNotificationShown(true); 140 NetworkProfileBubble::SetNotificationShown(true);
141 141
142 // 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
143 // before the next silence period starts. 143 // before the next silence period starts.
144 PrefService* prefs = browser->profile()->GetPrefs(); 144 PrefService* prefs = browser->profile()->GetPrefs();
145 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime, 145 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime,
146 base::Time::Now().ToTimeT()); 146 base::Time::Now().ToTimeT());
147 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); 147 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft);
148 if (left_warnings > 0) 148 if (left_warnings > 0)
149 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings); 149 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings);
150 } 150 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698