| 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/ash/chrome_shell_delegate.h" | 5 #include "chrome/browser/ui/ash/chrome_shell_delegate.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <limits> | 9 #include <limits> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "ash/shell.h" | 22 #include "ash/shell.h" |
| 23 #include "ash/wm/window_util.h" | 23 #include "ash/wm/window_util.h" |
| 24 #include "base/command_line.h" | 24 #include "base/command_line.h" |
| 25 #include "base/macros.h" | 25 #include "base/macros.h" |
| 26 #include "base/memory/ptr_util.h" | 26 #include "base/memory/ptr_util.h" |
| 27 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 28 #include "chrome/browser/app_mode/app_mode_utils.h" | 28 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 29 #include "chrome/browser/chrome_notification_types.h" | 29 #include "chrome/browser/chrome_notification_types.h" |
| 30 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" | 30 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 31 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" | 31 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 32 #include "chrome/browser/chromeos/arc/fileapi/arc_content_file_system_url_util.h
" |
| 32 #include "chrome/browser/chromeos/background/ash_wallpaper_delegate.h" | 33 #include "chrome/browser/chromeos/background/ash_wallpaper_delegate.h" |
| 33 #include "chrome/browser/chromeos/display/display_configuration_observer.h" | 34 #include "chrome/browser/chromeos/display/display_configuration_observer.h" |
| 34 #include "chrome/browser/chromeos/display/display_preferences.h" | 35 #include "chrome/browser/chromeos/display/display_preferences.h" |
| 35 #include "chrome/browser/chromeos/policy/display_rotation_default_handler.h" | 36 #include "chrome/browser/chromeos/policy/display_rotation_default_handler.h" |
| 36 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 37 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 37 #include "chrome/browser/chromeos/system/input_device_settings.h" | 38 #include "chrome/browser/chromeos/system/input_device_settings.h" |
| 38 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" | 39 #include "chrome/browser/chromeos/ui/accessibility_focus_ring_controller.h" |
| 39 #include "chrome/browser/lifetime/application_lifetime.h" | 40 #include "chrome/browser/lifetime/application_lifetime.h" |
| 40 #include "chrome/browser/profiles/profile.h" | 41 #include "chrome/browser/profiles/profile.h" |
| 41 #include "chrome/browser/profiles/profile_manager.h" | 42 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 404 } |
| 404 | 405 |
| 405 void ChromeShellDelegate::Exit() { | 406 void ChromeShellDelegate::Exit() { |
| 406 chrome::AttemptUserExit(); | 407 chrome::AttemptUserExit(); |
| 407 } | 408 } |
| 408 | 409 |
| 409 void ChromeShellDelegate::OpenUrlFromArc(const GURL& url) { | 410 void ChromeShellDelegate::OpenUrlFromArc(const GURL& url) { |
| 410 if (!url.is_valid()) | 411 if (!url.is_valid()) |
| 411 return; | 412 return; |
| 412 | 413 |
| 414 GURL url_to_open = url; |
| 415 if (url.SchemeIs(url::kFileScheme) || url.SchemeIs(url::kContentScheme)) { |
| 416 // Chrome cannot open this URL. Read the contents via ARC content file |
| 417 // system with an external file URL. |
| 418 url_to_open = arc::ArcUrlToExternalFileUrl(url_to_open); |
| 419 } |
| 420 |
| 413 chrome::ScopedTabbedBrowserDisplayer displayer( | 421 chrome::ScopedTabbedBrowserDisplayer displayer( |
| 414 ProfileManager::GetActiveUserProfile()); | 422 ProfileManager::GetActiveUserProfile()); |
| 415 chrome::AddSelectedTabWithURL( | 423 chrome::AddSelectedTabWithURL( |
| 416 displayer.browser(), url, | 424 displayer.browser(), url_to_open, |
| 417 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_LINK | | 425 ui::PageTransitionFromInt(ui::PAGE_TRANSITION_LINK | |
| 418 ui::PAGE_TRANSITION_FROM_API)); | 426 ui::PAGE_TRANSITION_FROM_API)); |
| 419 | 427 |
| 420 // Since the ScopedTabbedBrowserDisplayer does not guarantee that the | 428 // Since the ScopedTabbedBrowserDisplayer does not guarantee that the |
| 421 // browser will be shown on the active desktop, we ensure the visibility. | 429 // browser will be shown on the active desktop, we ensure the visibility. |
| 422 multi_user_util::MoveWindowToCurrentDesktop( | 430 multi_user_util::MoveWindowToCurrentDesktop( |
| 423 displayer.browser()->window()->GetNativeWindow()); | 431 displayer.browser()->window()->GetNativeWindow()); |
| 424 } | 432 } |
| 425 | 433 |
| 426 app_list::AppListPresenter* ChromeShellDelegate::GetAppListPresenter() { | 434 app_list::AppListPresenter* ChromeShellDelegate::GetAppListPresenter() { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 NOTREACHED() << "Unexpected notification " << type; | 560 NOTREACHED() << "Unexpected notification " << type; |
| 553 } | 561 } |
| 554 } | 562 } |
| 555 | 563 |
| 556 void ChromeShellDelegate::PlatformInit() { | 564 void ChromeShellDelegate::PlatformInit() { |
| 557 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 565 registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
| 558 content::NotificationService::AllSources()); | 566 content::NotificationService::AllSources()); |
| 559 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, | 567 registrar_.Add(this, chrome::NOTIFICATION_SESSION_STARTED, |
| 560 content::NotificationService::AllSources()); | 568 content::NotificationService::AllSources()); |
| 561 } | 569 } |
| OLD | NEW |