Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(440)

Side by Side Diff: chrome/browser/android/tab_android.cc

Issue 1233673002: Fix componentization of chrome/browser/bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix "gn check" and compilation on Mac Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/android/tab_android.h" 5 #include "chrome/browser/android/tab_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "cc/layers/layer.h" 12 #include "cc/layers/layer.h"
13 #include "chrome/browser/android/chrome_web_contents_delegate_android.h" 13 #include "chrome/browser/android/chrome_web_contents_delegate_android.h"
14 #include "chrome/browser/android/compositor/tab_content_manager.h" 14 #include "chrome/browser/android/compositor/tab_content_manager.h"
15 #include "chrome/browser/android/metrics/uma_utils.h" 15 #include "chrome/browser/android/metrics/uma_utils.h"
16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
17 #include "chrome/browser/bookmarks/chrome_bookmark_client.h" 17 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
18 #include "chrome/browser/bookmarks/chrome_bookmark_client_factory.h"
19 #include "chrome/browser/browser_about_handler.h" 18 #include "chrome/browser/browser_about_handler.h"
20 #include "chrome/browser/chrome_notification_types.h" 19 #include "chrome/browser/chrome_notification_types.h"
21 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 20 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
22 #include "chrome/browser/infobars/infobar_service.h" 21 #include "chrome/browser/infobars/infobar_service.h"
23 #include "chrome/browser/prerender/prerender_contents.h" 22 #include "chrome/browser/prerender/prerender_contents.h"
24 #include "chrome/browser/prerender/prerender_manager.h" 23 #include "chrome/browser/prerender/prerender_manager.h"
25 #include "chrome/browser/prerender/prerender_manager_factory.h" 24 #include "chrome/browser/prerender/prerender_manager_factory.h"
26 #include "chrome/browser/printing/print_view_manager_basic.h" 25 #include "chrome/browser/printing/print_view_manager_basic.h"
27 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/profiles/profile_android.h" 27 #include "chrome/browser/profiles/profile_android.h"
(...skipping 15 matching lines...) Expand all
44 #include "chrome/browser/ui/search/instant_search_prerenderer.h" 43 #include "chrome/browser/ui/search/instant_search_prerenderer.h"
45 #include "chrome/browser/ui/search/search_tab_helper.h" 44 #include "chrome/browser/ui/search/search_tab_helper.h"
46 #include "chrome/browser/ui/tab_contents/core_tab_helper.h" 45 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
47 #include "chrome/browser/ui/tab_helpers.h" 46 #include "chrome/browser/ui/tab_helpers.h"
48 #include "chrome/common/instant_types.h" 47 #include "chrome/common/instant_types.h"
49 #include "chrome/common/render_messages.h" 48 #include "chrome/common/render_messages.h"
50 #include "chrome/common/url_constants.h" 49 #include "chrome/common/url_constants.h"
51 #include "components/bookmarks/browser/bookmark_model.h" 50 #include "components/bookmarks/browser/bookmark_model.h"
52 #include "components/bookmarks/browser/bookmark_node.h" 51 #include "components/bookmarks/browser/bookmark_node.h"
53 #include "components/bookmarks/browser/bookmark_utils.h" 52 #include "components/bookmarks/browser/bookmark_utils.h"
53 #include "components/bookmarks/managed/managed_bookmark_service.h"
54 #include "components/dom_distiller/core/url_utils.h" 54 #include "components/dom_distiller/core/url_utils.h"
55 #include "components/favicon/content/content_favicon_driver.h" 55 #include "components/favicon/content/content_favicon_driver.h"
56 #include "components/infobars/core/infobar_container.h" 56 #include "components/infobars/core/infobar_container.h"
57 #include "components/navigation_interception/intercept_navigation_delegate.h" 57 #include "components/navigation_interception/intercept_navigation_delegate.h"
58 #include "components/navigation_interception/navigation_params.h" 58 #include "components/navigation_interception/navigation_params.h"
59 #include "components/url_fixer/url_fixer.h" 59 #include "components/url_fixer/url_fixer.h"
60 #include "content/public/browser/android/compositor.h" 60 #include "content/public/browser/android/compositor.h"
61 #include "content/public/browser/android/content_view_core.h" 61 #include "content/public/browser/android/content_view_core.h"
62 #include "content/public/browser/browser_thread.h" 62 #include "content/public/browser/browser_thread.h"
63 #include "content/public/browser/interstitial_page.h" 63 #include "content/public/browser/interstitial_page.h"
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 763
764 jlong TabAndroid::GetBookmarkId(JNIEnv* env, 764 jlong TabAndroid::GetBookmarkId(JNIEnv* env,
765 jobject obj, 765 jobject obj,
766 jboolean only_editable) { 766 jboolean only_editable) {
767 const GURL& url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl( 767 const GURL& url = dom_distiller::url_utils::GetOriginalUrlFromDistillerUrl(
768 web_contents()->GetURL()); 768 web_contents()->GetURL());
769 Profile* profile = GetProfile(); 769 Profile* profile = GetProfile();
770 770
771 // Get all the nodes for |url| and sort them by date added. 771 // Get all the nodes for |url| and sort them by date added.
772 std::vector<const bookmarks::BookmarkNode*> nodes; 772 std::vector<const bookmarks::BookmarkNode*> nodes;
773 ChromeBookmarkClient* client = 773 bookmarks::ManagedBookmarkService* managed =
774 ChromeBookmarkClientFactory::GetForProfile(profile); 774 ManagedBookmarkServiceFactory::GetForProfile(profile);
775 bookmarks::BookmarkModel* model = 775 bookmarks::BookmarkModel* model =
776 BookmarkModelFactory::GetForProfile(profile); 776 BookmarkModelFactory::GetForProfile(profile);
777 model->GetNodesByURL(url, &nodes); 777 model->GetNodesByURL(url, &nodes);
778 std::sort(nodes.begin(), nodes.end(), &bookmarks::MoreRecentlyAdded); 778 std::sort(nodes.begin(), nodes.end(), &bookmarks::MoreRecentlyAdded);
779 779
780 // Return the first node matching the search criteria. 780 // Return the first node matching the search criteria.
781 for (size_t i = 0; i < nodes.size(); ++i) { 781 for (size_t i = 0; i < nodes.size(); ++i) {
782 if (only_editable && !client->CanBeEditedByUser(nodes[i])) 782 if (only_editable && !managed->CanBeEditedByUser(nodes[i]))
783 continue; 783 continue;
784 return nodes[i]->id(); 784 return nodes[i]->id();
785 } 785 }
786 786
787 return -1; 787 return -1;
788 } 788 }
789 789
790 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env, jobject obj, jstring url) { 790 bool TabAndroid::HasPrerenderedUrl(JNIEnv* env, jobject obj, jstring url) {
791 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url)); 791 GURL gurl(base::android::ConvertJavaStringToUTF8(env, url));
792 return HasPrerenderedUrl(gurl); 792 return HasPrerenderedUrl(gurl);
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 // s^{n+1} / s^{n} = 2100 / 2000 878 // s^{n+1} / s^{n} = 2100 / 2000
879 // s = 1.05 879 // s = 1.05
880 // s^b = 60000 880 // s^b = 60000
881 // b = ln(60000) / ln(1.05) ~= 225 881 // b = ln(60000) / ln(1.05) ~= 225
882 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime", 882 UMA_HISTOGRAM_CUSTOM_TIMES("Startup.FirstCommitNavigationTime",
883 base::Time::Now() - chrome::android::GetMainEntryPointTime(), 883 base::Time::Now() - chrome::android::GetMainEntryPointTime(),
884 base::TimeDelta::FromMilliseconds(1), 884 base::TimeDelta::FromMilliseconds(1),
885 base::TimeDelta::FromMinutes(1), 885 base::TimeDelta::FromMinutes(1),
886 225); 886 225);
887 } 887 }
OLDNEW
« no previous file with comments | « chrome/browser/android/provider/chrome_browser_provider.cc ('k') | chrome/browser/bookmarks/chrome_bookmark_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698