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

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

Issue 10667026: Start consolidating cross-port file selection code into ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" 99 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
100 #include "chrome/browser/ui/browser_dialogs.h" 100 #include "chrome/browser/ui/browser_dialogs.h"
101 #include "chrome/browser/ui/browser_finder.h" 101 #include "chrome/browser/ui/browser_finder.h"
102 #include "chrome/browser/ui/browser_list.h" 102 #include "chrome/browser/ui/browser_list.h"
103 #include "chrome/browser/ui/browser_navigator.h" 103 #include "chrome/browser/ui/browser_navigator.h"
104 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h" 104 #include "chrome/browser/ui/browser_tab_restore_service_delegate.h"
105 #include "chrome/browser/ui/browser_toolbar_model_delegate.h" 105 #include "chrome/browser/ui/browser_toolbar_model_delegate.h"
106 #include "chrome/browser/ui/browser_ui_prefs.h" 106 #include "chrome/browser/ui/browser_ui_prefs.h"
107 #include "chrome/browser/ui/browser_window.h" 107 #include "chrome/browser/ui/browser_window.h"
108 #include "chrome/browser/ui/chrome_pages.h" 108 #include "chrome/browser/ui/chrome_pages.h"
109 #include "chrome/browser/ui/chrome_select_file_policy.h"
109 #include "chrome/browser/ui/constrained_window_tab_helper.h" 110 #include "chrome/browser/ui/constrained_window_tab_helper.h"
110 #include "chrome/browser/ui/extensions/shell_window.h" 111 #include "chrome/browser/ui/extensions/shell_window.h"
111 #include "chrome/browser/ui/find_bar/find_bar.h" 112 #include "chrome/browser/ui/find_bar/find_bar.h"
112 #include "chrome/browser/ui/find_bar/find_bar_controller.h" 113 #include "chrome/browser/ui/find_bar/find_bar_controller.h"
113 #include "chrome/browser/ui/find_bar/find_tab_helper.h" 114 #include "chrome/browser/ui/find_bar/find_tab_helper.h"
114 #include "chrome/browser/ui/fullscreen_controller.h" 115 #include "chrome/browser/ui/fullscreen_controller.h"
115 #include "chrome/browser/ui/global_error.h" 116 #include "chrome/browser/ui/global_error.h"
116 #include "chrome/browser/ui/global_error_service.h" 117 #include "chrome/browser/ui/global_error_service.h"
117 #include "chrome/browser/ui/global_error_service_factory.h" 118 #include "chrome/browser/ui/global_error_service_factory.h"
118 #include "chrome/browser/ui/hung_plugin_tab_helper.h" 119 #include "chrome/browser/ui/hung_plugin_tab_helper.h"
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding), 1004 profile_->GetPrefs()->GetString(prefs::kRecentlySelectedEncoding),
1004 encoding_id, 1005 encoding_id,
1005 &new_selected_encoding_list)) { 1006 &new_selected_encoding_list)) {
1006 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding, 1007 profile_->GetPrefs()->SetString(prefs::kRecentlySelectedEncoding,
1007 new_selected_encoding_list); 1008 new_selected_encoding_list);
1008 } 1009 }
1009 } 1010 }
1010 1011
1011 void Browser::OpenFile() { 1012 void Browser::OpenFile() {
1012 content::RecordAction(UserMetricsAction("OpenFile")); 1013 content::RecordAction(UserMetricsAction("OpenFile"));
1013 if (!select_file_dialog_.get()) 1014 select_file_dialog_ = SelectFileDialog::Create(
1014 select_file_dialog_ = SelectFileDialog::Create(this); 1015 this, new ChromeSelectFilePolicy(GetActiveWebContents()));
1015 1016
1016 const FilePath directory = profile_->last_selected_directory(); 1017 const FilePath directory = profile_->last_selected_directory();
1017 1018
1018 // TODO(beng): figure out how to juggle this. 1019 // TODO(beng): figure out how to juggle this.
1019 gfx::NativeWindow parent_window = window_->GetNativeWindow(); 1020 gfx::NativeWindow parent_window = window_->GetNativeWindow();
1020 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, 1021 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE,
1021 string16(), directory, 1022 string16(), directory,
1022 NULL, 0, FILE_PATH_LITERAL(""), 1023 NULL, 0, FILE_PATH_LITERAL(""),
1023 GetActiveWebContents(),
1024 parent_window, NULL); 1024 parent_window, NULL);
1025 } 1025 }
1026 1026
1027 void Browser::OpenCreateShortcutsDialog() { 1027 void Browser::OpenCreateShortcutsDialog() {
1028 content::RecordAction(UserMetricsAction("CreateShortcut")); 1028 content::RecordAction(UserMetricsAction("CreateShortcut"));
1029 #if !defined(OS_MACOSX) 1029 #if !defined(OS_MACOSX)
1030 TabContents* current_tab = GetActiveTabContents(); 1030 TabContents* current_tab = GetActiveTabContents();
1031 DCHECK(current_tab && 1031 DCHECK(current_tab &&
1032 web_app::IsValidUrl(current_tab->web_contents()->GetURL())) << 1032 web_app::IsValidUrl(current_tab->web_contents()->GetURL())) <<
1033 "Menu item should be disabled."; 1033 "Menu item should be disabled.";
(...skipping 2865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3899 if (contents && !allow_js_access) { 3899 if (contents && !allow_js_access) {
3900 contents->web_contents()->GetController().LoadURL( 3900 contents->web_contents()->GetController().LoadURL(
3901 target_url, 3901 target_url,
3902 content::Referrer(), 3902 content::Referrer(),
3903 content::PAGE_TRANSITION_LINK, 3903 content::PAGE_TRANSITION_LINK,
3904 std::string()); // No extra headers. 3904 std::string()); // No extra headers.
3905 } 3905 }
3906 3906
3907 return contents != NULL; 3907 return contents != NULL;
3908 } 3908 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698