| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/ui/chrome_bubble_manager.h" | 5 #include "chrome/browser/ui/chrome_bubble_manager.h" |
| 6 | 6 |
| 7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
| 8 #include "base/metrics/sparse_histogram.h" | 8 #include "base/metrics/sparse_histogram.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "components/bubble/bubble_controller.h" | 10 #include "components/bubble/bubble_controller.h" |
| 11 #include "components/bubble/bubble_delegate.h" | 11 #include "components/bubble/bubble_delegate.h" |
| 12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "content/public/browser/navigation_details.h" |
| 13 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 // Add any new enum before BUBBLE_TYPE_MAX and update BubbleType in | 18 // Add any new enum before BUBBLE_TYPE_MAX and update BubbleType in |
| 18 // tools/metrics/histograms/histograms.xml. | 19 // tools/metrics/histograms/histograms.xml. |
| 19 // Do not re-number these because they are used for collecting metrics. | 20 // Do not re-number these because they are used for collecting metrics. |
| 20 // Related bubbles can be grouped together every 10 values. | 21 // Related bubbles can be grouped together every 10 values. |
| 21 enum BubbleType { | 22 enum BubbleType { |
| 22 // Special bubble values: | 23 // Special bubble values: |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 153 |
| 153 void ChromeBubbleManager::DidToggleFullscreenModeForTab( | 154 void ChromeBubbleManager::DidToggleFullscreenModeForTab( |
| 154 bool entered_fullscreen, bool will_cause_resize) { | 155 bool entered_fullscreen, bool will_cause_resize) { |
| 155 CloseAllBubbles(BUBBLE_CLOSE_FULLSCREEN_TOGGLED); | 156 CloseAllBubbles(BUBBLE_CLOSE_FULLSCREEN_TOGGLED); |
| 156 // Any bubble that didn't close should update its anchor position. | 157 // Any bubble that didn't close should update its anchor position. |
| 157 UpdateAllBubbleAnchors(); | 158 UpdateAllBubbleAnchors(); |
| 158 } | 159 } |
| 159 | 160 |
| 160 void ChromeBubbleManager::NavigationEntryCommitted( | 161 void ChromeBubbleManager::NavigationEntryCommitted( |
| 161 const content::LoadCommittedDetails& load_details) { | 162 const content::LoadCommittedDetails& load_details) { |
| 162 CloseAllBubbles(BUBBLE_CLOSE_NAVIGATED); | 163 if (!load_details.is_in_page) |
| 164 CloseAllBubbles(BUBBLE_CLOSE_NAVIGATED); |
| 163 } | 165 } |
| 164 | 166 |
| 165 void ChromeBubbleManager::ChromeBubbleMetrics::OnBubbleNeverShown( | 167 void ChromeBubbleManager::ChromeBubbleMetrics::OnBubbleNeverShown( |
| 166 BubbleReference bubble) { | 168 BubbleReference bubble) { |
| 167 UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.NeverShown", GetBubbleId(bubble)); | 169 UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.NeverShown", GetBubbleId(bubble)); |
| 168 } | 170 } |
| 169 | 171 |
| 170 void ChromeBubbleManager::ChromeBubbleMetrics::OnBubbleClosed( | 172 void ChromeBubbleManager::ChromeBubbleMetrics::OnBubbleClosed( |
| 171 BubbleReference bubble, BubbleCloseReason reason) { | 173 BubbleReference bubble, BubbleCloseReason reason) { |
| 172 // Log the amount of time the bubble was visible. | 174 // Log the amount of time the bubble was visible. |
| 173 base::TimeDelta visible_time = bubble->GetVisibleTime(); | 175 base::TimeDelta visible_time = bubble->GetVisibleTime(); |
| 174 UMA_HISTOGRAM_LONG_TIMES("Bubbles.DisplayTime.All", visible_time); | 176 UMA_HISTOGRAM_LONG_TIMES("Bubbles.DisplayTime.All", visible_time); |
| 175 | 177 |
| 176 LogBubbleCloseReason(bubble, reason); | 178 LogBubbleCloseReason(bubble, reason); |
| 177 } | 179 } |
| OLD | NEW |