OLD | NEW |
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" | 52 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" |
53 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" | 53 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" |
54 #include "chrome/browser/extensions/browser_extension_window_controller.h" | 54 #include "chrome/browser/extensions/browser_extension_window_controller.h" |
55 #include "chrome/browser/extensions/extension_service.h" | 55 #include "chrome/browser/extensions/extension_service.h" |
56 #include "chrome/browser/extensions/extension_util.h" | 56 #include "chrome/browser/extensions/extension_util.h" |
57 #include "chrome/browser/extensions/tab_helper.h" | 57 #include "chrome/browser/extensions/tab_helper.h" |
58 #include "chrome/browser/favicon/favicon_tab_helper.h" | 58 #include "chrome/browser/favicon/favicon_tab_helper.h" |
59 #include "chrome/browser/file_select_helper.h" | 59 #include "chrome/browser/file_select_helper.h" |
60 #include "chrome/browser/first_run/first_run.h" | 60 #include "chrome/browser/first_run/first_run.h" |
61 #include "chrome/browser/history/top_sites.h" | 61 #include "chrome/browser/history/top_sites.h" |
| 62 #include "chrome/browser/history/top_sites_factory.h" |
62 #include "chrome/browser/infobars/infobar_service.h" | 63 #include "chrome/browser/infobars/infobar_service.h" |
63 #include "chrome/browser/lifetime/application_lifetime.h" | 64 #include "chrome/browser/lifetime/application_lifetime.h" |
64 #include "chrome/browser/notifications/notification_ui_manager.h" | 65 #include "chrome/browser/notifications/notification_ui_manager.h" |
65 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 66 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
66 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 67 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
67 #include "chrome/browser/profiles/profile.h" | 68 #include "chrome/browser/profiles/profile.h" |
68 #include "chrome/browser/profiles/profile_destroyer.h" | 69 #include "chrome/browser/profiles/profile_destroyer.h" |
69 #include "chrome/browser/profiles/profile_metrics.h" | 70 #include "chrome/browser/profiles/profile_metrics.h" |
70 #include "chrome/browser/repost_form_warning_controller.h" | 71 #include "chrome/browser/repost_form_warning_controller.h" |
71 #include "chrome/browser/search/search.h" | 72 #include "chrome/browser/search/search.h" |
(...skipping 1803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1875 DCHECK(web_contents); | 1876 DCHECK(web_contents); |
1876 if (tab_strip_model_->GetActiveWebContents() == web_contents) | 1877 if (tab_strip_model_->GetActiveWebContents() == web_contents) |
1877 UpdateToolbar(false); | 1878 UpdateToolbar(false); |
1878 } | 1879 } |
1879 | 1880 |
1880 OmniboxView* Browser::GetOmniboxView() { | 1881 OmniboxView* Browser::GetOmniboxView() { |
1881 return window_->GetLocationBar()->GetOmniboxView(); | 1882 return window_->GetLocationBar()->GetOmniboxView(); |
1882 } | 1883 } |
1883 | 1884 |
1884 std::set<std::string> Browser::GetOpenUrls() { | 1885 std::set<std::string> Browser::GetOpenUrls() { |
1885 history::TopSites* top_sites = profile_->GetTopSites(); | 1886 scoped_refptr<history::TopSites> top_sites = |
| 1887 TopSitesFactory::GetForProfile(profile_); |
1886 if (!top_sites) // NULL for Incognito profiles. | 1888 if (!top_sites) // NULL for Incognito profiles. |
1887 return std::set<std::string>(); | 1889 return std::set<std::string>(); |
1888 | 1890 |
1889 std::set<std::string> open_urls; | 1891 std::set<std::string> open_urls; |
1890 chrome::GetOpenUrls(*tab_strip_model_, *top_sites, &open_urls); | 1892 chrome::GetOpenUrls(*tab_strip_model_, *top_sites.get(), &open_urls); |
1891 return open_urls; | 1893 return open_urls; |
1892 } | 1894 } |
1893 | 1895 |
1894 /////////////////////////////////////////////////////////////////////////////// | 1896 /////////////////////////////////////////////////////////////////////////////// |
1895 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: | 1897 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: |
1896 | 1898 |
1897 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, | 1899 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, |
1898 bool blocked) { | 1900 bool blocked) { |
1899 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); | 1901 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); |
1900 if (index == TabStripModel::kNoTab) { | 1902 if (index == TabStripModel::kNoTab) { |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2510 if (contents && !allow_js_access) { | 2512 if (contents && !allow_js_access) { |
2511 contents->web_contents()->GetController().LoadURL( | 2513 contents->web_contents()->GetController().LoadURL( |
2512 target_url, | 2514 target_url, |
2513 content::Referrer(), | 2515 content::Referrer(), |
2514 ui::PAGE_TRANSITION_LINK, | 2516 ui::PAGE_TRANSITION_LINK, |
2515 std::string()); // No extra headers. | 2517 std::string()); // No extra headers. |
2516 } | 2518 } |
2517 | 2519 |
2518 return contents != NULL; | 2520 return contents != NULL; |
2519 } | 2521 } |
OLD | NEW |