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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 #include "chrome/browser/download/download_shelf.h" | 51 #include "chrome/browser/download/download_shelf.h" |
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_provider.h" |
| 62 #include "chrome/browser/history/top_sites_service_factory.h" |
62 #include "chrome/browser/infobars/infobar_service.h" | 63 #include "chrome/browser/infobars/infobar_service.h" |
63 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" | 64 #include "chrome/browser/infobars/simple_alert_infobar_delegate.h" |
64 #include "chrome/browser/lifetime/application_lifetime.h" | 65 #include "chrome/browser/lifetime/application_lifetime.h" |
65 #include "chrome/browser/notifications/notification_ui_manager.h" | 66 #include "chrome/browser/notifications/notification_ui_manager.h" |
66 #include "chrome/browser/pepper_broker_infobar_delegate.h" | 67 #include "chrome/browser/pepper_broker_infobar_delegate.h" |
67 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 68 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
68 #include "chrome/browser/profiles/profile.h" | 69 #include "chrome/browser/profiles/profile.h" |
69 #include "chrome/browser/profiles/profile_destroyer.h" | 70 #include "chrome/browser/profiles/profile_destroyer.h" |
70 #include "chrome/browser/profiles/profile_metrics.h" | 71 #include "chrome/browser/profiles/profile_metrics.h" |
71 #include "chrome/browser/repost_form_warning_controller.h" | 72 #include "chrome/browser/repost_form_warning_controller.h" |
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 DCHECK(web_contents); | 1875 DCHECK(web_contents); |
1875 if (tab_strip_model_->GetActiveWebContents() == web_contents) | 1876 if (tab_strip_model_->GetActiveWebContents() == web_contents) |
1876 UpdateToolbar(false); | 1877 UpdateToolbar(false); |
1877 } | 1878 } |
1878 | 1879 |
1879 OmniboxView* Browser::GetOmniboxView() { | 1880 OmniboxView* Browser::GetOmniboxView() { |
1880 return window_->GetLocationBar()->GetOmniboxView(); | 1881 return window_->GetLocationBar()->GetOmniboxView(); |
1881 } | 1882 } |
1882 | 1883 |
1883 std::set<std::string> Browser::GetOpenUrls() { | 1884 std::set<std::string> Browser::GetOpenUrls() { |
1884 history::TopSites* top_sites = profile_->GetTopSites(); | 1885 history::TopSitesProvider* top_sites_provider = |
1885 if (!top_sites) // NULL for Incognito profiles. | 1886 TopSitesServiceFactory::GetForProfile(profile_); |
| 1887 if (!top_sites_provider) // NULL for Incognito profiles. |
1886 return std::set<std::string>(); | 1888 return std::set<std::string>(); |
1887 | 1889 |
1888 std::set<std::string> open_urls; | 1890 std::set<std::string> open_urls; |
1889 chrome::GetOpenUrls(*tab_strip_model_, *top_sites, &open_urls); | 1891 chrome::GetOpenUrls(*tab_strip_model_, *top_sites_provider, &open_urls); |
1890 return open_urls; | 1892 return open_urls; |
1891 } | 1893 } |
1892 | 1894 |
1893 /////////////////////////////////////////////////////////////////////////////// | 1895 /////////////////////////////////////////////////////////////////////////////// |
1894 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: | 1896 // Browser, web_modal::WebContentsModalDialogManagerDelegate implementation: |
1895 | 1897 |
1896 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, | 1898 void Browser::SetWebContentsBlocked(content::WebContents* web_contents, |
1897 bool blocked) { | 1899 bool blocked) { |
1898 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); | 1900 int index = tab_strip_model_->GetIndexOfWebContents(web_contents); |
1899 if (index == TabStripModel::kNoTab) { | 1901 if (index == TabStripModel::kNoTab) { |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2509 if (contents && !allow_js_access) { | 2511 if (contents && !allow_js_access) { |
2510 contents->web_contents()->GetController().LoadURL( | 2512 contents->web_contents()->GetController().LoadURL( |
2511 target_url, | 2513 target_url, |
2512 content::Referrer(), | 2514 content::Referrer(), |
2513 ui::PAGE_TRANSITION_LINK, | 2515 ui::PAGE_TRANSITION_LINK, |
2514 std::string()); // No extra headers. | 2516 std::string()); // No extra headers. |
2515 } | 2517 } |
2516 | 2518 |
2517 return contents != NULL; | 2519 return contents != NULL; |
2518 } | 2520 } |
OLD | NEW |