| 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/browser_dialogs.h" | 8 #include "chrome/browser/ui/browser_dialogs.h" |
| 9 #include "chrome/browser/ui/layout_constants.h" | 9 #include "chrome/browser/ui/layout_constants.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/app_menu_button.h" | 12 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" |
| 16 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 17 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
| 18 #include "components/strings/grit/components_strings.h" | 18 #include "components/strings/grit/components_strings.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
| 20 #include "ui/views/bubble/bubble_dialog_delegate.h" | 20 #include "ui/views/bubble/bubble_dialog_delegate.h" |
| 21 #include "ui/views/controls/label.h" | 21 #include "ui/views/controls/label.h" |
| 22 #include "ui/views/controls/link.h" | 22 #include "ui/views/controls/link.h" |
| 23 #include "ui/views/controls/link_listener.h" | 23 #include "ui/views/controls/link_listener.h" |
| 24 #include "ui/views/layout/fill_layout.h" | 24 #include "ui/views/layout/fill_layout.h" |
| 25 #include "ui/views/layout/layout_constants.h" | |
| 26 | 25 |
| 27 namespace { | 26 namespace { |
| 28 | 27 |
| 29 // Bubble layout constants. | 28 // Bubble layout constants. |
| 30 const int kNotificationBubbleWidth = 250; | 29 const int kNotificationBubbleWidth = 250; |
| 31 | 30 |
| 32 class NetworkProfileBubbleView : public views::BubbleDialogDelegateView, | 31 class NetworkProfileBubbleView : public views::BubbleDialogDelegateView, |
| 33 public views::LinkListener { | 32 public views::LinkListener { |
| 34 public: | 33 public: |
| 35 NetworkProfileBubbleView(views::View* anchor, | 34 NetworkProfileBubbleView(views::View* anchor, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 143 |
| 145 // Mark the time of the last bubble and reduce the number of warnings left | 144 // Mark the time of the last bubble and reduce the number of warnings left |
| 146 // before the next silence period starts. | 145 // before the next silence period starts. |
| 147 PrefService* prefs = browser->profile()->GetPrefs(); | 146 PrefService* prefs = browser->profile()->GetPrefs(); |
| 148 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime, | 147 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime, |
| 149 base::Time::Now().ToTimeT()); | 148 base::Time::Now().ToTimeT()); |
| 150 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); | 149 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); |
| 151 if (left_warnings > 0) | 150 if (left_warnings > 0) |
| 152 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings); | 151 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings); |
| 153 } | 152 } |
| OLD | NEW |