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

Side by Side Diff: chrome/browser/ui/browser.cc

Issue 861273002: Make TopSites a RefcountedKeyedService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win compilation Created 5 years, 11 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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/ui/browser.h" 5 #include "chrome/browser/ui/browser.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #endif // defined(OS_WIN) 10 #endif // defined(OS_WIN)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" 51 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h"
52 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" 52 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h"
53 #include "chrome/browser/extensions/browser_extension_window_controller.h" 53 #include "chrome/browser/extensions/browser_extension_window_controller.h"
54 #include "chrome/browser/extensions/extension_service.h" 54 #include "chrome/browser/extensions/extension_service.h"
55 #include "chrome/browser/extensions/extension_util.h" 55 #include "chrome/browser/extensions/extension_util.h"
56 #include "chrome/browser/extensions/tab_helper.h" 56 #include "chrome/browser/extensions/tab_helper.h"
57 #include "chrome/browser/favicon/favicon_tab_helper.h" 57 #include "chrome/browser/favicon/favicon_tab_helper.h"
58 #include "chrome/browser/file_select_helper.h" 58 #include "chrome/browser/file_select_helper.h"
59 #include "chrome/browser/first_run/first_run.h" 59 #include "chrome/browser/first_run/first_run.h"
60 #include "chrome/browser/history/top_sites.h" 60 #include "chrome/browser/history/top_sites.h"
61 #include "chrome/browser/history/top_sites_factory.h"
61 #include "chrome/browser/infobars/infobar_service.h" 62 #include "chrome/browser/infobars/infobar_service.h"
62 #include "chrome/browser/lifetime/application_lifetime.h" 63 #include "chrome/browser/lifetime/application_lifetime.h"
63 #include "chrome/browser/notifications/notification_ui_manager.h" 64 #include "chrome/browser/notifications/notification_ui_manager.h"
64 #include "chrome/browser/pepper_broker_infobar_delegate.h" 65 #include "chrome/browser/pepper_broker_infobar_delegate.h"
65 #include "chrome/browser/prefs/incognito_mode_prefs.h" 66 #include "chrome/browser/prefs/incognito_mode_prefs.h"
66 #include "chrome/browser/profiles/profile.h" 67 #include "chrome/browser/profiles/profile.h"
67 #include "chrome/browser/profiles/profile_destroyer.h" 68 #include "chrome/browser/profiles/profile_destroyer.h"
68 #include "chrome/browser/profiles/profile_metrics.h" 69 #include "chrome/browser/profiles/profile_metrics.h"
69 #include "chrome/browser/repost_form_warning_controller.h" 70 #include "chrome/browser/repost_form_warning_controller.h"
70 #include "chrome/browser/search/search.h" 71 #include "chrome/browser/search/search.h"
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 DCHECK(web_contents); 1878 DCHECK(web_contents);
1878 if (tab_strip_model_->GetActiveWebContents() == web_contents) 1879 if (tab_strip_model_->GetActiveWebContents() == web_contents)
1879 UpdateToolbar(false); 1880 UpdateToolbar(false);
1880 } 1881 }
1881 1882
1882 OmniboxView* Browser::GetOmniboxView() { 1883 OmniboxView* Browser::GetOmniboxView() {
1883 return window_->GetLocationBar()->GetOmniboxView(); 1884 return window_->GetLocationBar()->GetOmniboxView();
1884 } 1885 }
1885 1886
1886 std::set<std::string> Browser::GetOpenUrls() { 1887 std::set<std::string> Browser::GetOpenUrls() {
1887 history::TopSites* top_sites = profile_->GetTopSites(); 1888 scoped_refptr<history::TopSites> top_sites =
1889 TopSitesFactory::GetForProfile(profile_);
1888 if (!top_sites) // NULL for Incognito profiles. 1890 if (!top_sites) // NULL for Incognito profiles.
1889 return std::set<std::string>(); 1891 return std::set<std::string>();
1890 1892
1891 std::set<std::string> open_urls; 1893 std::set<std::string> open_urls;
1892 chrome::GetOpenUrls(*tab_strip_model_, *top_sites, &open_urls); 1894 chrome::GetOpenUrls(*tab_strip_model_, *top_sites.get(), &open_urls);
1893 return open_urls; 1895 return open_urls;
1894 } 1896 }
1895 1897
1896 /////////////////////////////////////////////////////////////////////////////// 1898 ///////////////////////////////////////////////////////////////////////////////
1897 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: 1899 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation:
1898 1900
1899 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, 1901 void Browser::SetWebContentsBlocked(content::WebContents* web_contents,
1900 bool blocked) { 1902 bool blocked) {
1901 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); 1903 int index = tab_strip_model_->GetIndexOfWebContents(web_contents);
1902 if (index == TabStripModel::kNoTab) { 1904 if (index == TabStripModel::kNoTab) {
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2512 if (contents && !allow_js_access) { 2514 if (contents && !allow_js_access) {
2513 contents->web_contents()->GetController().LoadURL( 2515 contents->web_contents()->GetController().LoadURL(
2514 target_url, 2516 target_url,
2515 content::Referrer(), 2517 content::Referrer(),
2516 ui::PAGE_TRANSITION_LINK, 2518 ui::PAGE_TRANSITION_LINK,
2517 std::string()); // No extra headers. 2519 std::string()); // No extra headers.
2518 } 2520 }
2519 2521
2520 return contents != NULL; 2522 return contents != NULL;
2521 } 2523 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_list/test/fake_profile.cc ('k') | chrome/browser/ui/views/frame/global_menu_bar_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698