| Index: chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc
|
| diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc
|
| index c1d4a7955b68da43c3f5b244e14044c5b451be83..a121914277570713ef09825062209647ca98ffb7 100644
|
| --- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc
|
| +++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.cc
|
| @@ -4,25 +4,75 @@
|
|
|
| #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_views.h"
|
|
|
| +#include "chrome/browser/ui/app_list/app_list_service.h"
|
| +#include "chrome/browser/ui/host_desktop.h"
|
| #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_manage_tab.h"
|
| #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_tab.h"
|
| #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_summary_tab.h"
|
| #include "chrome/browser/ui/views/constrained_window_views.h"
|
| #include "grit/generated_resources.h"
|
| +#include "ui/app_list/app_list_switches.h"
|
| +#include "ui/app_list/views/app_list_view.h"
|
| +#include "ui/aura/window.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| +#include "ui/views/bubble/bubble_border.h"
|
| +#include "ui/views/bubble/bubble_frame_view.h"
|
| #include "ui/views/controls/tabbed_pane/tabbed_pane.h"
|
| #include "ui/views/layout/fill_layout.h"
|
| #include "ui/views/layout/layout_manager.h"
|
| #include "ui/views/widget/widget.h"
|
| #include "ui/views/window/dialog_delegate.h"
|
|
|
| +namespace {
|
| +
|
| +// Shows/hides the modal overlay on the app list. Has no effect if the app list
|
| +// is not visible.
|
| +void ShowBackgroundOverlay(bool visible, gfx::NativeWindow native_window) {
|
| + app_list::AppListView* app_list_view =
|
| + AppListService::Get(chrome::GetHostDesktopTypeForNativeWindow(
|
| + native_window))->GetAppListView();
|
| + if (app_list_view)
|
| + app_list_view->ShowAppListOverlay(visible);
|
| +}
|
| +
|
| +// Returns the current bounds of the app list. Returns an 0x0 rect if the app
|
| +// list is not visible.
|
| +gfx::Rect GetAppListWindowBounds(gfx::NativeWindow native_window) {
|
| + app_list::AppListView* app_list_view =
|
| + AppListService::Get(chrome::GetHostDesktopTypeForNativeWindow(
|
| + native_window))->GetAppListView();
|
| + if (app_list_view)
|
| + return app_list_view->GetBoundsInScreen();
|
| + return gfx::Rect();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| void ShowAppInfoDialog(gfx::NativeWindow parent_window,
|
| Profile* profile,
|
| const extensions::Extension* app,
|
| const base::Closure& close_callback) {
|
| - CreateBrowserModalDialogViews(
|
| + ShowBackgroundOverlay(true, parent_window);
|
| +
|
| + // The dialog is inset so the app list is still visible around the edges.
|
| + unsigned int kAppListDialogHorizontalBorderInsets = 10;
|
| + unsigned int kAppListDialogVerticalBorderInsets = 10;
|
| +
|
| + // If we are using the experimental app list, inset the dialog further so it
|
| + // appears as a vertical column in the center of the app list.
|
| + if (app_list::switches::IsExperimentalAppListEnabled()) {
|
| + kAppListDialogHorizontalBorderInsets += 100;
|
| + }
|
| +
|
| + gfx::Rect dialog_bounds = GetAppListWindowBounds(parent_window);
|
| + dialog_bounds.Inset(kAppListDialogHorizontalBorderInsets,
|
| + kAppListDialogVerticalBorderInsets);
|
| +
|
| + views::Widget* dialog = CreateBrowserModalDialogViews(
|
| new AppInfoDialog(parent_window, profile, app, close_callback),
|
| - parent_window)->Show();
|
| + parent_window);
|
| + dialog->SetBounds(dialog_bounds);
|
| + dialog->Show();
|
| }
|
|
|
| AppInfoDialog::AppInfoDialog(gfx::NativeWindow parent_window,
|
| @@ -51,6 +101,7 @@ AppInfoDialog::AppInfoDialog(gfx::NativeWindow parent_window,
|
| AppInfoDialog::~AppInfoDialog() {}
|
|
|
| bool AppInfoDialog::Cancel() {
|
| + ShowBackgroundOverlay(false, parent_window_);
|
| if (!close_callback_.is_null())
|
| close_callback_.Run();
|
| return true;
|
|
|