12e2725239c3761147d88e0322427cc63b70c7b96kristianm/* 22e2725239c3761147d88e0322427cc63b70c7b96kristianm * Copyright (C) 2010 The Android Open Source Project 32e2725239c3761147d88e0322427cc63b70c7b96kristianm * 42e2725239c3761147d88e0322427cc63b70c7b96kristianm * Licensed under the Apache License, Version 2.0 (the "License"); 52e2725239c3761147d88e0322427cc63b70c7b96kristianm * you may not use this file except in compliance with the License. 62e2725239c3761147d88e0322427cc63b70c7b96kristianm * You may obtain a copy of the License at 72e2725239c3761147d88e0322427cc63b70c7b96kristianm * 82e2725239c3761147d88e0322427cc63b70c7b96kristianm * http://www.apache.org/licenses/LICENSE-2.0 92e2725239c3761147d88e0322427cc63b70c7b96kristianm * 102e2725239c3761147d88e0322427cc63b70c7b96kristianm * Unless required by applicable law or agreed to in writing, software 112e2725239c3761147d88e0322427cc63b70c7b96kristianm * distributed under the License is distributed on an "AS IS" BASIS, 122e2725239c3761147d88e0322427cc63b70c7b96kristianm * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 132e2725239c3761147d88e0322427cc63b70c7b96kristianm * See the License for the specific language governing permissions and 142e2725239c3761147d88e0322427cc63b70c7b96kristianm * limitations under the License. 152e2725239c3761147d88e0322427cc63b70c7b96kristianm */ 162e2725239c3761147d88e0322427cc63b70c7b96kristianm 172e2725239c3761147d88e0322427cc63b70c7b96kristianmpackage com.android.browser; 182e2725239c3761147d88e0322427cc63b70c7b96kristianm 192e2725239c3761147d88e0322427cc63b70c7b96kristianmimport android.util.EventLog; 202e2725239c3761147d88e0322427cc63b70c7b96kristianm 212e2725239c3761147d88e0322427cc63b70c7b96kristianmpublic class LogTag { 222e2725239c3761147d88e0322427cc63b70c7b96kristianm 232e2725239c3761147d88e0322427cc63b70c7b96kristianm /** 242e2725239c3761147d88e0322427cc63b70c7b96kristianm * Log when the user is adding a new bookmark. 252e2725239c3761147d88e0322427cc63b70c7b96kristianm * 262e2725239c3761147d88e0322427cc63b70c7b96kristianm * @param url the url of the new bookmark. 270a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen * @param where the location from where the bookmark was added 282e2725239c3761147d88e0322427cc63b70c7b96kristianm */ 290a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen public static void logBookmarkAdded(String url, String where) { 300a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen EventLog.writeEvent(EventLogTags.BROWSER_BOOKMARK_ADDED, url + "|" 310a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen + where); 322e2725239c3761147d88e0322427cc63b70c7b96kristianm } 332e2725239c3761147d88e0322427cc63b70c7b96kristianm 342e2725239c3761147d88e0322427cc63b70c7b96kristianm /** 352e2725239c3761147d88e0322427cc63b70c7b96kristianm * Log when a page has finished loading with how much 362e2725239c3761147d88e0322427cc63b70c7b96kristianm * time the browser used to load the page. 372e2725239c3761147d88e0322427cc63b70c7b96kristianm * 384dce3bf588b7eaf4de555a93b67f5ddf9bc1ba77Kristian Monsen * Note that a redirect will restart the timer, so this time is not 394dce3bf588b7eaf4de555a93b67f5ddf9bc1ba77Kristian Monsen * always how long it takes for the user to load a page. 404dce3bf588b7eaf4de555a93b67f5ddf9bc1ba77Kristian Monsen * 410a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen * @param url the url of that page that finished loading. 422e2725239c3761147d88e0322427cc63b70c7b96kristianm * @param duration the time the browser spent loading the page. 432e2725239c3761147d88e0322427cc63b70c7b96kristianm */ 442e2725239c3761147d88e0322427cc63b70c7b96kristianm public static void logPageFinishedLoading(String url, long duration) { 454dce3bf588b7eaf4de555a93b67f5ddf9bc1ba77Kristian Monsen EventLog.writeEvent(EventLogTags.BROWSER_PAGE_LOADED, url + "|" 460a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen + duration); 472e2725239c3761147d88e0322427cc63b70c7b96kristianm } 482e2725239c3761147d88e0322427cc63b70c7b96kristianm 492e2725239c3761147d88e0322427cc63b70c7b96kristianm /** 502e2725239c3761147d88e0322427cc63b70c7b96kristianm * log the time the user has spent on a webpage 512e2725239c3761147d88e0322427cc63b70c7b96kristianm * 522e2725239c3761147d88e0322427cc63b70c7b96kristianm * @param url the url of the page that is being logged (old page). 532e2725239c3761147d88e0322427cc63b70c7b96kristianm * @param duration the time spent on the webpage. 542e2725239c3761147d88e0322427cc63b70c7b96kristianm */ 552e2725239c3761147d88e0322427cc63b70c7b96kristianm public static void logTimeOnPage(String url, long duration) { 564dce3bf588b7eaf4de555a93b67f5ddf9bc1ba77Kristian Monsen EventLog.writeEvent(EventLogTags.BROWSER_TIMEONPAGE, url + "|" 570a1d838ccd16ac08300bb8ac89b61ee0c956a49bKristian Monsen + duration); 582e2725239c3761147d88e0322427cc63b70c7b96kristianm } 592e2725239c3761147d88e0322427cc63b70c7b96kristianm} 60