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 18 matching lines...) Expand all Loading... |
29 #include "chrome/app/chrome_command_ids.h" | 29 #include "chrome/app/chrome_command_ids.h" |
30 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 30 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
31 #include "chrome/browser/background/background_contents_service.h" | 31 #include "chrome/browser/background/background_contents_service.h" |
32 #include "chrome/browser/background/background_contents_service_factory.h" | 32 #include "chrome/browser/background/background_contents_service_factory.h" |
33 #include "chrome/browser/bookmarks/bookmark_model.h" | 33 #include "chrome/browser/bookmarks/bookmark_model.h" |
34 #include "chrome/browser/bookmarks/bookmark_utils.h" | 34 #include "chrome/browser/bookmarks/bookmark_utils.h" |
35 #include "chrome/browser/browser_process.h" | 35 #include "chrome/browser/browser_process.h" |
36 #include "chrome/browser/browser_shutdown.h" | 36 #include "chrome/browser/browser_shutdown.h" |
37 #include "chrome/browser/character_encoding.h" | 37 #include "chrome/browser/character_encoding.h" |
38 #include "chrome/browser/chrome_page_zoom.h" | 38 #include "chrome/browser/chrome_page_zoom.h" |
| 39 #include "chrome/browser/chrome_select_file_policy.h" |
39 #include "chrome/browser/content_settings/host_content_settings_map.h" | 40 #include "chrome/browser/content_settings/host_content_settings_map.h" |
40 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 41 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
41 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" | 42 #include "chrome/browser/custom_handlers/register_protocol_handler_infobar_deleg
ate.h" |
42 #include "chrome/browser/debugger/devtools_toggle_action.h" | 43 #include "chrome/browser/debugger/devtools_toggle_action.h" |
43 #include "chrome/browser/debugger/devtools_window.h" | 44 #include "chrome/browser/debugger/devtools_window.h" |
44 #include "chrome/browser/download/download_crx_util.h" | 45 #include "chrome/browser/download/download_crx_util.h" |
45 #include "chrome/browser/download/download_item_model.h" | 46 #include "chrome/browser/download/download_item_model.h" |
46 #include "chrome/browser/download/download_service.h" | 47 #include "chrome/browser/download/download_service.h" |
47 #include "chrome/browser/download/download_service_factory.h" | 48 #include "chrome/browser/download/download_service_factory.h" |
48 #include "chrome/browser/download/download_shelf.h" | 49 #include "chrome/browser/download/download_shelf.h" |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 | 1514 |
1514 void Browser::OpenFile() { | 1515 void Browser::OpenFile() { |
1515 content::RecordAction(UserMetricsAction("OpenFile")); | 1516 content::RecordAction(UserMetricsAction("OpenFile")); |
1516 if (!select_file_dialog_.get()) | 1517 if (!select_file_dialog_.get()) |
1517 select_file_dialog_ = SelectFileDialog::Create(this); | 1518 select_file_dialog_ = SelectFileDialog::Create(this); |
1518 | 1519 |
1519 const FilePath directory = profile_->last_selected_directory(); | 1520 const FilePath directory = profile_->last_selected_directory(); |
1520 | 1521 |
1521 // TODO(beng): figure out how to juggle this. | 1522 // TODO(beng): figure out how to juggle this. |
1522 gfx::NativeWindow parent_window = window_->GetNativeWindow(); | 1523 gfx::NativeWindow parent_window = window_->GetNativeWindow(); |
1523 select_file_dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 1524 select_file_dialog_->SelectFile( |
1524 string16(), directory, | 1525 SelectFileDialog::SELECT_OPEN_FILE, |
1525 NULL, 0, FILE_PATH_LITERAL(""), | 1526 string16(), directory, |
1526 GetActiveWebContents(), | 1527 NULL, 0, FILE_PATH_LITERAL(""), |
1527 parent_window, NULL); | 1528 ChromeSelectFilePolicy::DisplayInfobarCallback(GetActiveWebContents()), |
| 1529 parent_window, NULL); |
1528 } | 1530 } |
1529 | 1531 |
1530 void Browser::OpenCreateShortcutsDialog() { | 1532 void Browser::OpenCreateShortcutsDialog() { |
1531 content::RecordAction(UserMetricsAction("CreateShortcut")); | 1533 content::RecordAction(UserMetricsAction("CreateShortcut")); |
1532 #if !defined(OS_MACOSX) | 1534 #if !defined(OS_MACOSX) |
1533 TabContents* current_tab = GetActiveTabContents(); | 1535 TabContents* current_tab = GetActiveTabContents(); |
1534 DCHECK(current_tab && | 1536 DCHECK(current_tab && |
1535 web_app::IsValidUrl(current_tab->web_contents()->GetURL())) << | 1537 web_app::IsValidUrl(current_tab->web_contents()->GetURL())) << |
1536 "Menu item should be disabled."; | 1538 "Menu item should be disabled."; |
1537 | 1539 |
(...skipping 3214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4752 if (contents && !allow_js_access) { | 4754 if (contents && !allow_js_access) { |
4753 contents->web_contents()->GetController().LoadURL( | 4755 contents->web_contents()->GetController().LoadURL( |
4754 target_url, | 4756 target_url, |
4755 content::Referrer(), | 4757 content::Referrer(), |
4756 content::PAGE_TRANSITION_LINK, | 4758 content::PAGE_TRANSITION_LINK, |
4757 std::string()); // No extra headers. | 4759 std::string()); // No extra headers. |
4758 } | 4760 } |
4759 | 4761 |
4760 return contents != NULL; | 4762 return contents != NULL; |
4761 } | 4763 } |
OLD | NEW |