| 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/layout_constants.h" | 9 #include "chrome/browser/ui/layout_constants.h" |
| 9 #include "chrome/browser/ui/network_profile_bubble.h" | 10 #include "chrome/browser/ui/network_profile_bubble.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 11 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 11 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" | 12 #include "chrome/browser/ui/views/toolbar/app_menu_button.h" |
| 12 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" | 13 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" |
| 13 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 14 #include "chrome/grit/chromium_strings.h" | 15 #include "chrome/grit/chromium_strings.h" |
| 15 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 16 #include "components/prefs/pref_service.h" | 17 #include "components/prefs/pref_service.h" |
| 17 #include "components/strings/grit/components_strings.h" | 18 #include "components/strings/grit/components_strings.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 NetworkProfileBubbleView::NetworkProfileBubbleView( | 60 NetworkProfileBubbleView::NetworkProfileBubbleView( |
| 60 views::View* anchor, | 61 views::View* anchor, |
| 61 content::PageNavigator* navigator, | 62 content::PageNavigator* navigator, |
| 62 Profile* profile) | 63 Profile* profile) |
| 63 : BubbleDialogDelegateView(anchor, views::BubbleBorder::TOP_RIGHT), | 64 : BubbleDialogDelegateView(anchor, views::BubbleBorder::TOP_RIGHT), |
| 64 navigator_(navigator), | 65 navigator_(navigator), |
| 65 profile_(profile) { | 66 profile_(profile) { |
| 66 // Compensate for built-in vertical padding in the anchor view's image. | 67 // Compensate for built-in vertical padding in the anchor view's image. |
| 67 set_anchor_view_insets(gfx::Insets( | 68 set_anchor_view_insets(gfx::Insets( |
| 68 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 69 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| 70 chrome::RecordDialogCreation( |
| 71 chrome::DialogIdentifier::NETWORK_SHARE_PROFILE_WARNING); |
| 69 } | 72 } |
| 70 | 73 |
| 71 //////////////////////////////////////////////////////////////////////////////// | 74 //////////////////////////////////////////////////////////////////////////////// |
| 72 // NetworkProfileBubbleView, private: | 75 // NetworkProfileBubbleView, private: |
| 73 | 76 |
| 74 NetworkProfileBubbleView::~NetworkProfileBubbleView() { | 77 NetworkProfileBubbleView::~NetworkProfileBubbleView() { |
| 75 } | 78 } |
| 76 | 79 |
| 77 void NetworkProfileBubbleView::Init() { | 80 void NetworkProfileBubbleView::Init() { |
| 78 SetLayoutManager(new views::FillLayout()); | 81 SetLayoutManager(new views::FillLayout()); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 | 144 |
| 142 // Mark the time of the last bubble and reduce the number of warnings left | 145 // Mark the time of the last bubble and reduce the number of warnings left |
| 143 // before the next silence period starts. | 146 // before the next silence period starts. |
| 144 PrefService* prefs = browser->profile()->GetPrefs(); | 147 PrefService* prefs = browser->profile()->GetPrefs(); |
| 145 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime, | 148 prefs->SetInt64(prefs::kNetworkProfileLastWarningTime, |
| 146 base::Time::Now().ToTimeT()); | 149 base::Time::Now().ToTimeT()); |
| 147 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); | 150 int left_warnings = prefs->GetInteger(prefs::kNetworkProfileWarningsLeft); |
| 148 if (left_warnings > 0) | 151 if (left_warnings > 0) |
| 149 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings); | 152 prefs->SetInteger(prefs::kNetworkProfileWarningsLeft, --left_warnings); |
| 150 } | 153 } |
| OLD | NEW |