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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 } | 854 } |
855 | 855 |
856 void Browser::UpdateDownloadShelfVisibility(bool visible) { | 856 void Browser::UpdateDownloadShelfVisibility(bool visible) { |
857 if (GetStatusBubble()) | 857 if (GetStatusBubble()) |
858 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); | 858 GetStatusBubble()->UpdateDownloadShelfVisibility(visible); |
859 } | 859 } |
860 | 860 |
861 /////////////////////////////////////////////////////////////////////////////// | 861 /////////////////////////////////////////////////////////////////////////////// |
862 | 862 |
863 void Browser::UpdateUIForNavigationInTab(WebContents* contents, | 863 void Browser::UpdateUIForNavigationInTab(WebContents* contents, |
864 content::PageTransition transition, | 864 ui::PageTransition transition, |
865 bool user_initiated) { | 865 bool user_initiated) { |
866 tab_strip_model_->TabNavigating(contents, transition); | 866 tab_strip_model_->TabNavigating(contents, transition); |
867 | 867 |
868 bool contents_is_selected = | 868 bool contents_is_selected = |
869 contents == tab_strip_model_->GetActiveWebContents(); | 869 contents == tab_strip_model_->GetActiveWebContents(); |
870 if (user_initiated && contents_is_selected && window()->GetLocationBar()) { | 870 if (user_initiated && contents_is_selected && window()->GetLocationBar()) { |
871 // Forcibly reset the location bar if the url is going to change in the | 871 // Forcibly reset the location bar if the url is going to change in the |
872 // current tab, since otherwise it won't discard any ongoing user edits, | 872 // current tab, since otherwise it won't discard any ongoing user edits, |
873 // since it doesn't realize this is a user-initiated action. | 873 // since it doesn't realize this is a user-initiated action. |
874 window()->GetLocationBar()->Revert(); | 874 window()->GetLocationBar()->Revert(); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1829 content::WebContents* source_contents) { | 1829 content::WebContents* source_contents) { |
1830 DCHECK(source_contents); | 1830 DCHECK(source_contents); |
1831 // We're guaranteed that AUTO_BOOKMARK is the right transition since this only | 1831 // We're guaranteed that AUTO_BOOKMARK is the right transition since this only |
1832 // gets called to handle clicks in the new tab page (to navigate to most | 1832 // gets called to handle clicks in the new tab page (to navigate to most |
1833 // visited item URLs) and in the search results page (to navigate to | 1833 // visited item URLs) and in the search results page (to navigate to |
1834 // privileged destinations (e.g. chrome://URLs)). | 1834 // privileged destinations (e.g. chrome://URLs)). |
1835 // | 1835 // |
1836 // TODO(kmadhusu): Page transitions to privileged destinations should be | 1836 // TODO(kmadhusu): Page transitions to privileged destinations should be |
1837 // marked as "LINK" instead of "AUTO_BOOKMARK"? | 1837 // marked as "LINK" instead of "AUTO_BOOKMARK"? |
1838 chrome::NavigateParams params(this, url, | 1838 chrome::NavigateParams params(this, url, |
1839 content::PAGE_TRANSITION_AUTO_BOOKMARK); | 1839 ui::PAGE_TRANSITION_AUTO_BOOKMARK); |
1840 params.referrer = content::Referrer(); | 1840 params.referrer = content::Referrer(); |
1841 params.source_contents = source_contents; | 1841 params.source_contents = source_contents; |
1842 params.disposition = disposition; | 1842 params.disposition = disposition; |
1843 params.is_renderer_initiated = false; | 1843 params.is_renderer_initiated = false; |
1844 params.initiating_profile = profile_; | 1844 params.initiating_profile = profile_; |
1845 chrome::Navigate(¶ms); | 1845 chrome::Navigate(¶ms); |
1846 } | 1846 } |
1847 | 1847 |
1848 void Browser::OnWebContentsInstantSupportDisabled( | 1848 void Browser::OnWebContentsInstantSupportDisabled( |
1849 const content::WebContents* web_contents) { | 1849 const content::WebContents* web_contents) { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1924 GURL url = net::FilePathToFileURL(file_info.local_path); | 1924 GURL url = net::FilePathToFileURL(file_info.local_path); |
1925 | 1925 |
1926 #if defined(OS_CHROMEOS) | 1926 #if defined(OS_CHROMEOS) |
1927 drive::util::MaybeSetDriveURL(profile_, file_info.file_path, &url); | 1927 drive::util::MaybeSetDriveURL(profile_, file_info.file_path, &url); |
1928 #endif | 1928 #endif |
1929 | 1929 |
1930 if (url.is_empty()) | 1930 if (url.is_empty()) |
1931 return; | 1931 return; |
1932 | 1932 |
1933 OpenURL(OpenURLParams( | 1933 OpenURL(OpenURLParams( |
1934 url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED, false)); | 1934 url, Referrer(), CURRENT_TAB, ui::PAGE_TRANSITION_TYPED, false)); |
1935 } | 1935 } |
1936 | 1936 |
1937 /////////////////////////////////////////////////////////////////////////////// | 1937 /////////////////////////////////////////////////////////////////////////////// |
1938 // Browser, content::NotificationObserver implementation: | 1938 // Browser, content::NotificationObserver implementation: |
1939 | 1939 |
1940 void Browser::Observe(int type, | 1940 void Browser::Observe(int type, |
1941 const content::NotificationSource& source, | 1941 const content::NotificationSource& source, |
1942 const content::NotificationDetails& details) { | 1942 const content::NotificationDetails& details) { |
1943 switch (type) { | 1943 switch (type) { |
1944 case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { | 1944 case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 base::ASCIIToUTF16(extension->id()), | 2471 base::ASCIIToUTF16(extension->id()), |
2472 partition_id, | 2472 partition_id, |
2473 session_storage_namespace); | 2473 session_storage_namespace); |
2474 | 2474 |
2475 // When a separate process is used, the original renderer cannot access the | 2475 // When a separate process is used, the original renderer cannot access the |
2476 // new window later, thus we need to navigate the window now. | 2476 // new window later, thus we need to navigate the window now. |
2477 if (contents && !allow_js_access) { | 2477 if (contents && !allow_js_access) { |
2478 contents->web_contents()->GetController().LoadURL( | 2478 contents->web_contents()->GetController().LoadURL( |
2479 target_url, | 2479 target_url, |
2480 content::Referrer(), | 2480 content::Referrer(), |
2481 content::PAGE_TRANSITION_LINK, | 2481 ui::PAGE_TRANSITION_LINK, |
2482 std::string()); // No extra headers. | 2482 std::string()); // No extra headers. |
2483 } | 2483 } |
2484 | 2484 |
2485 return contents != NULL; | 2485 return contents != NULL; |
2486 } | 2486 } |
OLD | NEW |