| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/tab_contents/tab_contents.h" | 5 #include "chrome/browser/tab_contents/tab_contents.h" |
| 6 | 6 |
| 7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
| 8 // For GdkScreen | 8 // For GdkScreen |
| 9 #include <gdk/gdk.h> | 9 #include <gdk/gdk.h> |
| 10 #endif // defined(OS_CHROMEOS) | 10 #endif // defined(OS_CHROMEOS) |
| (...skipping 2559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2570 case ViewHostMsg_RunFileChooser_Params::OpenMultiple: | 2570 case ViewHostMsg_RunFileChooser_Params::OpenMultiple: |
| 2571 dialog_type = SelectFileDialog::SELECT_OPEN_MULTI_FILE; | 2571 dialog_type = SelectFileDialog::SELECT_OPEN_MULTI_FILE; |
| 2572 break; | 2572 break; |
| 2573 case ViewHostMsg_RunFileChooser_Params::Save: | 2573 case ViewHostMsg_RunFileChooser_Params::Save: |
| 2574 dialog_type = SelectFileDialog::SELECT_SAVEAS_FILE; | 2574 dialog_type = SelectFileDialog::SELECT_SAVEAS_FILE; |
| 2575 break; | 2575 break; |
| 2576 default: | 2576 default: |
| 2577 dialog_type = SelectFileDialog::SELECT_OPEN_FILE; // Prevent warning. | 2577 dialog_type = SelectFileDialog::SELECT_OPEN_FILE; // Prevent warning. |
| 2578 NOTREACHED(); | 2578 NOTREACHED(); |
| 2579 } | 2579 } |
| 2580 FilePath default_file_name = params.default_file_name; |
| 2581 if (default_file_name.empty()) |
| 2582 default_file_name = profile()->last_selected_directory(); |
| 2580 select_file_dialog_->SelectFile(dialog_type, params.title, | 2583 select_file_dialog_->SelectFile(dialog_type, params.title, |
| 2581 params.default_file_name, | 2584 default_file_name, |
| 2582 NULL, 0, FILE_PATH_LITERAL(""), | 2585 NULL, 0, FILE_PATH_LITERAL(""), |
| 2583 view_->GetTopLevelNativeWindow(), NULL); | 2586 view_->GetTopLevelNativeWindow(), NULL); |
| 2584 } | 2587 } |
| 2585 | 2588 |
| 2586 void TabContents::RunJavaScriptMessage( | 2589 void TabContents::RunJavaScriptMessage( |
| 2587 const std::wstring& message, | 2590 const std::wstring& message, |
| 2588 const std::wstring& default_prompt, | 2591 const std::wstring& default_prompt, |
| 2589 const GURL& frame_url, | 2592 const GURL& frame_url, |
| 2590 const int flags, | 2593 const int flags, |
| 2591 IPC::Message* reply_msg, | 2594 IPC::Message* reply_msg, |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 | 2835 |
| 2833 void TabContents::FocusedNodeChanged() { | 2836 void TabContents::FocusedNodeChanged() { |
| 2834 NotificationService::current()->Notify( | 2837 NotificationService::current()->Notify( |
| 2835 NotificationType::FOCUS_CHANGED_IN_PAGE, | 2838 NotificationType::FOCUS_CHANGED_IN_PAGE, |
| 2836 Source<RenderViewHost>(render_view_host()), | 2839 Source<RenderViewHost>(render_view_host()), |
| 2837 NotificationService::NoDetails()); | 2840 NotificationService::NoDetails()); |
| 2838 } | 2841 } |
| 2839 | 2842 |
| 2840 void TabContents::FileSelected(const FilePath& path, | 2843 void TabContents::FileSelected(const FilePath& path, |
| 2841 int index, void* params) { | 2844 int index, void* params) { |
| 2845 profile()->set_last_selected_directory(path.DirName()); |
| 2842 std::vector<FilePath> files; | 2846 std::vector<FilePath> files; |
| 2843 files.push_back(path); | 2847 files.push_back(path); |
| 2844 render_view_host()->FilesSelectedInChooser(files); | 2848 render_view_host()->FilesSelectedInChooser(files); |
| 2845 } | 2849 } |
| 2846 | 2850 |
| 2847 void TabContents::MultiFilesSelected(const std::vector<FilePath>& files, | 2851 void TabContents::MultiFilesSelected(const std::vector<FilePath>& files, |
| 2848 void* params) { | 2852 void* params) { |
| 2853 if (!files.empty()) |
| 2854 profile()->set_last_selected_directory(files[0].DirName()); |
| 2849 render_view_host()->FilesSelectedInChooser(files); | 2855 render_view_host()->FilesSelectedInChooser(files); |
| 2850 } | 2856 } |
| 2851 | 2857 |
| 2852 void TabContents::FileSelectionCanceled(void* params) { | 2858 void TabContents::FileSelectionCanceled(void* params) { |
| 2853 // If the user cancels choosing a file to upload we pass back an | 2859 // If the user cancels choosing a file to upload we pass back an |
| 2854 // empty vector. | 2860 // empty vector. |
| 2855 render_view_host()->FilesSelectedInChooser(std::vector<FilePath>()); | 2861 render_view_host()->FilesSelectedInChooser(std::vector<FilePath>()); |
| 2856 } | 2862 } |
| 2857 | 2863 |
| 2858 void TabContents::BeforeUnloadFiredFromRenderManager( | 2864 void TabContents::BeforeUnloadFiredFromRenderManager( |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3181 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); | 3187 AddInfoBar(new SavePasswordInfoBarDelegate(this, form_to_save)); |
| 3182 } | 3188 } |
| 3183 | 3189 |
| 3184 Profile* TabContents::GetProfileForPasswordManager() { | 3190 Profile* TabContents::GetProfileForPasswordManager() { |
| 3185 return profile(); | 3191 return profile(); |
| 3186 } | 3192 } |
| 3187 | 3193 |
| 3188 bool TabContents::DidLastPageLoadEncounterSSLErrors() { | 3194 bool TabContents::DidLastPageLoadEncounterSSLErrors() { |
| 3189 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); | 3195 return controller().ssl_manager()->ProcessedSSLErrorFromRequest(); |
| 3190 } | 3196 } |
| OLD | NEW |