| 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/extensions/shell_window.h" | 5 #include "chrome/browser/ui/extensions/shell_window.h" |
| 6 | 6 |
| 7 #include "apps/shell_window_geometry_cache.h" | 7 #include "apps/shell_window_geometry_cache.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/extensions/app_window_contents.h" | 10 #include "chrome/browser/extensions/app_window_contents.h" |
| 11 #include "chrome/browser/extensions/extension_process_manager.h" | 11 #include "chrome/browser/extensions/extension_process_manager.h" |
| 12 #include "chrome/browser/extensions/extension_system.h" | 12 #include "chrome/browser/extensions/extension_system.h" |
| 13 #include "chrome/browser/extensions/image_loader.h" | 13 #include "chrome/browser/extensions/image_loader.h" |
| 14 #include "chrome/browser/extensions/shell_window_registry.h" | 14 #include "chrome/browser/extensions/shell_window_registry.h" |
| 15 #include "chrome/browser/extensions/suggest_permission_util.h" | 15 #include "chrome/browser/extensions/suggest_permission_util.h" |
| 16 #include "chrome/browser/favicon/favicon_tab_helper.h" | 16 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 17 #include "chrome/browser/file_select_helper.h" | 17 #include "chrome/browser/file_select_helper.h" |
| 18 #include "chrome/browser/lifetime/application_lifetime.h" | 18 #include "chrome/browser/lifetime/application_lifetime.h" |
| 19 #include "chrome/browser/media/media_capture_devices_dispatcher.h" | 19 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
| 21 #include "chrome/browser/sessions/session_id.h" | 21 #include "chrome/browser/sessions/session_id.h" |
| 22 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 23 #include "chrome/browser/ui/browser_dialogs.h" |
| 23 #include "chrome/browser/ui/browser_finder.h" | 24 #include "chrome/browser/ui/browser_finder.h" |
| 24 #include "chrome/browser/ui/browser_tabstrip.h" | 25 #include "chrome/browser/ui/browser_tabstrip.h" |
| 25 #include "chrome/browser/ui/browser_window.h" | 26 #include "chrome/browser/ui/browser_window.h" |
| 26 #include "chrome/browser/ui/extensions/native_app_window.h" | 27 #include "chrome/browser/ui/extensions/native_app_window.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 28 #include "chrome/common/extensions/extension.h" | 29 #include "chrome/common/extensions/extension.h" |
| 29 #include "chrome/common/extensions/extension_constants.h" | 30 #include "chrome/common/extensions/extension_constants.h" |
| 30 #include "chrome/common/extensions/extension_messages.h" | 31 #include "chrome/common/extensions/extension_messages.h" |
| 31 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" | 32 #include "chrome/common/extensions/manifest_handlers/icons_handler.h" |
| 32 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 33 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 } | 462 } |
| 462 | 463 |
| 463 void ShellWindow::CloseContents(WebContents* contents) { | 464 void ShellWindow::CloseContents(WebContents* contents) { |
| 464 native_app_window_->Close(); | 465 native_app_window_->Close(); |
| 465 } | 466 } |
| 466 | 467 |
| 467 bool ShellWindow::ShouldSuppressDialogs() { | 468 bool ShellWindow::ShouldSuppressDialogs() { |
| 468 return true; | 469 return true; |
| 469 } | 470 } |
| 470 | 471 |
| 472 content::ColorChooser* ShellWindow::OpenColorChooser(WebContents* web_contents, |
| 473 SkColor initial_color) { |
| 474 return chrome::ShowColorChooser(web_contents, initial_color); |
| 475 } |
| 476 |
| 471 void ShellWindow::RunFileChooser(WebContents* tab, | 477 void ShellWindow::RunFileChooser(WebContents* tab, |
| 472 const content::FileChooserParams& params) { | 478 const content::FileChooserParams& params) { |
| 473 if (window_type_is_panel()) { | 479 if (window_type_is_panel()) { |
| 474 // Panels can't host a file dialog, abort. TODO(stevenjb): allow file | 480 // Panels can't host a file dialog, abort. TODO(stevenjb): allow file |
| 475 // dialogs to be unhosted but still close with the owning web contents. | 481 // dialogs to be unhosted but still close with the owning web contents. |
| 476 // crbug.com/172502. | 482 // crbug.com/172502. |
| 477 LOG(WARNING) << "File dialog opened by panel."; | 483 LOG(WARNING) << "File dialog opened by panel."; |
| 478 return; | 484 return; |
| 479 } | 485 } |
| 480 FileSelectHelper::RunFileChooser(tab, params); | 486 FileSelectHelper::RunFileChooser(tab, params); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 const extensions::DraggableRegion& region = *iter; | 594 const extensions::DraggableRegion& region = *iter; |
| 589 sk_region->op( | 595 sk_region->op( |
| 590 region.bounds.x(), | 596 region.bounds.x(), |
| 591 region.bounds.y(), | 597 region.bounds.y(), |
| 592 region.bounds.right(), | 598 region.bounds.right(), |
| 593 region.bounds.bottom(), | 599 region.bounds.bottom(), |
| 594 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); | 600 region.draggable ? SkRegion::kUnion_Op : SkRegion::kDifference_Op); |
| 595 } | 601 } |
| 596 return sk_region; | 602 return sk_region; |
| 597 } | 603 } |
| OLD | NEW |