| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/webui/ntp/android/navigation_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/android/navigation_handler.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "chrome/browser/google/google_util.h" | 11 #include "chrome/browser/google/google_util.h" |
| 12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 13 #include "content/public/browser/navigation_entry.h" | 13 #include "content/public/browser/navigation_entry.h" |
| 14 #include "content/public/browser/web_contents.h" | 14 #include "content/public/browser/web_contents.h" |
| 15 #include "content/public/browser/web_ui.h" | 15 #include "content/public/browser/web_ui.h" |
| 16 #include "content/public/common/page_transition_types.h" | 16 #include "content/public/common/page_transition_types.h" |
| 17 | 17 |
| 18 NavigationHandler::NavigationHandler() {} | 18 NavigationHandler::NavigationHandler() {} |
| 19 | 19 |
| 20 NavigationHandler::~NavigationHandler() { | 20 NavigationHandler::~NavigationHandler() { |
| 21 // Record an omnibox-based navigation, if there is one. | 21 // Record an omnibox-based navigation, if there is one. |
| 22 content::NavigationEntry* entry = | 22 content::NavigationEntry* entry = |
| 23 web_ui()->GetWebContents()->GetController().GetActiveEntry(); | 23 web_ui()->GetWebContents()->GetController().GetVisibleEntry(); |
| 24 if (!entry) | 24 if (!entry) |
| 25 return; | 25 return; |
| 26 | 26 |
| 27 if (!(entry->GetTransitionType() & | 27 if (!(entry->GetTransitionType() & |
| 28 content::PAGE_TRANSITION_FROM_ADDRESS_BAR) || | 28 content::PAGE_TRANSITION_FROM_ADDRESS_BAR) || |
| 29 entry->GetTransitionType() & content::PAGE_TRANSITION_FORWARD_BACK) { | 29 entry->GetTransitionType() & content::PAGE_TRANSITION_FORWARD_BACK) { |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 | 32 |
| 33 if (entry->GetURL().SchemeIs(chrome::kChromeUIScheme) && | 33 if (entry->GetURL().SchemeIs(chrome::kChromeUIScheme) && |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 } else { | 87 } else { |
| 88 action = ACTION_NAVIGATED_USING_OMNIBOX; | 88 action = ACTION_NAVIGATED_USING_OMNIBOX; |
| 89 } | 89 } |
| 90 RecordAction(action); | 90 RecordAction(action); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // static | 93 // static |
| 94 void NavigationHandler::RecordAction(Action action) { | 94 void NavigationHandler::RecordAction(Action action) { |
| 95 UMA_HISTOGRAM_ENUMERATION("NewTabPage.ActionAndroid", action, NUM_ACTIONS); | 95 UMA_HISTOGRAM_ENUMERATION("NewTabPage.ActionAndroid", action, NUM_ACTIONS); |
| 96 } | 96 } |
| OLD | NEW |