| OLD | NEW |
| 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/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 // OS_WIN | 10 #endif // OS_WIN |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" | 100 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" |
| 101 #include "chrome/browser/ui/browser_dialogs.h" | 101 #include "chrome/browser/ui/browser_dialogs.h" |
| 102 #include "chrome/browser/ui/browser_finder.h" | 102 #include "chrome/browser/ui/browser_finder.h" |
| 103 #include "chrome/browser/ui/browser_list.h" | 103 #include "chrome/browser/ui/browser_list.h" |
| 104 #include "chrome/browser/ui/browser_navigator.h" | 104 #include "chrome/browser/ui/browser_navigator.h" |
| 105 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" | 105 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" |
| 106 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" | 106 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" |
| 107 #include "chrome/browser/ui/browser_ui_prefs.h" | 107 #include "chrome/browser/ui/browser_ui_prefs.h" |
| 108 #include "chrome/browser/ui/browser_window.h" | 108 #include "chrome/browser/ui/browser_window.h" |
| 109 #include "chrome/browser/ui/chrome_pages.h" | 109 #include "chrome/browser/ui/chrome_pages.h" |
| 110 #include "chrome/browser/ui/chrome_select_file_policy.h" | |
| 111 #include "chrome/browser/ui/constrained_window_tab_helper.h" | 110 #include "chrome/browser/ui/constrained_window_tab_helper.h" |
| 112 #include "chrome/browser/ui/extensions/shell_window.h" | 111 #include "chrome/browser/ui/extensions/shell_window.h" |
| 113 #include "chrome/browser/ui/find_bar/find_bar.h" | 112 #include "chrome/browser/ui/find_bar/find_bar.h" |
| 114 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 113 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
| 115 #include "chrome/browser/ui/find_bar/find_tab_helper.h" | 114 #include "chrome/browser/ui/find_bar/find_tab_helper.h" |
| 116 #include "chrome/browser/ui/fullscreen_controller.h" | 115 #include "chrome/browser/ui/fullscreen_controller.h" |
| 117 #include "chrome/browser/ui/global_error.h" | 116 #include "chrome/browser/ui/global_error.h" |
| 118 #include "chrome/browser/ui/global_error_service.h" | 117 #include "chrome/browser/ui/global_error_service.h" |
| 119 #include "chrome/browser/ui/global_error_service_factory.h" | 118 #include "chrome/browser/ui/global_error_service_factory.h" |
| 120 #include "chrome/browser/ui/hung_plugin_tab_helper.h" | 119 #include "chrome/browser/ui/hung_plugin_tab_helper.h" |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), | 948 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), |
| 950 encoding_id, | 949 encoding_id, |
| 951 &new_selected_encoding_list)) { | 950 &new_selected_encoding_list)) { |
| 952 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, | 951 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, |
| 953 new_selected_encoding_list); | 952 new_selected_encoding_list); |
| 954 } | 953 } |
| 955 } | 954 } |
| 956 | 955 |
| 957 void Browser::OpenFile() { | 956 void Browser::OpenFile() { |
| 958 content::RecordAction(UserMetricsAction("OpenFile")); | 957 content::RecordAction(UserMetricsAction("OpenFile")); |
| 959 select_file_dialog_ = SelectFileDialog::Create( | 958 if (!select_file_dialog_.get()) |
| 960 this, new ChromeSelectFilePolicy(GetActiveWebContents())); | 959 select_file_dialog_ = SelectFileDialog::Create(this); |
| 961 | 960 |
| 962 const FilePath directory = profile_->last_selected_directory(); | 961 const FilePath directory = profile_->last_selected_directory(); |
| 963 | 962 |
| 964 // TODO(beng): figure out how to juggle this. | 963 // TODO(beng): figure out how to juggle this. |
| 965 gfx::NativeWindow parent_window = window_->GetNativeWindow(); | 964 gfx::NativeWindow parent_window = window_->GetNativeWindow(); |
| 966 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 965 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, |
| 967 string16(), directory, | 966 string16(), directory, |
| 968 NULL, 0, FILE_PATH_LITERAL(""), | 967 NULL, 0, FILE_PATH_LITERAL(""), |
| 968 GetActiveWebContents(), |
| 969 parent_window, NULL); | 969 parent_window, NULL); |
| 970 } | 970 } |
| 971 | 971 |
| 972 void Browser::OpenCreateShortcutsDialog() { | 972 void Browser::OpenCreateShortcutsDialog() { |
| 973 content::RecordAction(UserMetricsAction("CreateShortcut")); | 973 content::RecordAction(UserMetricsAction("CreateShortcut")); |
| 974 #if !defined(OS_MACOSX) | 974 #if !defined(OS_MACOSX) |
| 975 TabContents* current_tab = GetActiveTabContents(); | 975 TabContents* current_tab = GetActiveTabContents(); |
| 976 DCHECK(current_tab && | 976 DCHECK(current_tab && |
| 977 web_app::IsValidUrl(current_tab->web_contents()->GetURL())) << | 977 web_app::IsValidUrl(current_tab->web_contents()->GetURL())) << |
| 978 "Menu item should be disabled."; | 978 "Menu item should be disabled."; |
| (...skipping 2055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3034 if (contents && !allow_js_access) { | 3034 if (contents && !allow_js_access) { |
| 3035 contents->web_contents()->GetController().LoadURL( | 3035 contents->web_contents()->GetController().LoadURL( |
| 3036 target_url, | 3036 target_url, |
| 3037 content::Referrer(), | 3037 content::Referrer(), |
| 3038 content::PAGE_TRANSITION_LINK, | 3038 content::PAGE_TRANSITION_LINK, |
| 3039 std::string()); // No extra headers. | 3039 std::string()); // No extra headers. |
| 3040 } | 3040 } |
| 3041 | 3041 |
| 3042 return contents != NULL; | 3042 return contents != NULL; |
| 3043 } | 3043 } |
| OLD | NEW |