Commit 842b7e3c authored by Yulun Wu's avatar Yulun Wu Committed by Commit Bot

CROS: Handle Shelf GetAppInfo when there are no active Browser and WebContents.

Bug: 1000169
Change-Id: Id3e32e8587a1449f08c7de73c394eb4cf7c2d1be
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783801
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Cr-Commit-Position: refs/heads/master@{#696892}
parent 3cf13003
...@@ -48,6 +48,12 @@ void ShowAppInfoInAppList(gfx::NativeWindow parent, ...@@ -48,6 +48,12 @@ void ShowAppInfoInAppList(gfx::NativeWindow parent,
const extensions::Extension* app); const extensions::Extension* app);
#endif #endif
// Shows the chrome app information in an independent dialog box and runs
// close_callback when the app info window is closed.
void ShowAppInfo(Profile* profile,
const extensions::Extension* app,
const base::Closure& close_callback);
// Shows the chrome app information in a native dialog box. // Shows the chrome app information in a native dialog box.
void ShowAppInfoInNativeDialog(content::WebContents* web_contents, void ShowAppInfoInNativeDialog(content::WebContents* web_contents,
Profile* profile, Profile* profile,
......
...@@ -866,11 +866,7 @@ void ChromeLauncherController::DoShowAppInfoFlow( ...@@ -866,11 +866,7 @@ void ChromeLauncherController::DoShowAppInfoFlow(
AppInfoLaunchSource::FROM_SHELF, AppInfoLaunchSource::FROM_SHELF,
AppInfoLaunchSource::NUM_LAUNCH_SOURCES); AppInfoLaunchSource::NUM_LAUNCH_SOURCES);
ShowAppInfoInNativeDialog(BrowserList::GetInstance() ShowAppInfo(profile, extension, base::Closure());
->GetLastActive()
->tab_strip_model()
->GetActiveWebContents(),
profile, extension, base::Closure());
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/apps/app_info_dialog.h" #include "chrome/browser/ui/apps/app_info_dialog.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/scoped_tabbed_browser_displayer.h"
#include "chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.h" #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_dialog_container.h"
#include "chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.h" #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_footer_panel.h"
#include "chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h" #include "chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h"
...@@ -50,6 +52,7 @@ namespace { ...@@ -50,6 +52,7 @@ namespace {
// The color of the separator used inside the dialog - should match the app // The color of the separator used inside the dialog - should match the app
// list's app_list::kDialogSeparatorColor // list's app_list::kDialogSeparatorColor
constexpr SkColor kDialogSeparatorColor = SkColorSetRGB(0xD1, 0xD1, 0xD1); constexpr SkColor kDialogSeparatorColor = SkColorSetRGB(0xD1, 0xD1, 0xD1);
constexpr gfx::Size kDialogSize = gfx::Size(380, 490);
} // namespace } // namespace
...@@ -76,11 +79,21 @@ void ShowAppInfoInAppList(gfx::NativeWindow parent, ...@@ -76,11 +79,21 @@ void ShowAppInfoInAppList(gfx::NativeWindow parent,
} }
#endif #endif
void ShowAppInfo(Profile* profile,
const extensions::Extension* app,
const base::Closure& close_callback) {
views::DialogDelegate* dialog = CreateDialogContainerForView(
std::make_unique<AppInfoDialog>(profile, app), kDialogSize,
close_callback);
views::Widget* dialog_widget =
views::DialogDelegate::CreateDialogWidget(dialog, nullptr, nullptr);
dialog_widget->Show();
}
void ShowAppInfoInNativeDialog(content::WebContents* web_contents, void ShowAppInfoInNativeDialog(content::WebContents* web_contents,
Profile* profile, Profile* profile,
const extensions::Extension* app, const extensions::Extension* app,
const base::Closure& close_callback) { const base::Closure& close_callback) {
constexpr gfx::Size kDialogSize = gfx::Size(380, 490);
views::DialogDelegate* dialog = CreateDialogContainerForView( views::DialogDelegate* dialog = CreateDialogContainerForView(
std::make_unique<AppInfoDialog>(profile, app), kDialogSize, std::make_unique<AppInfoDialog>(profile, app), kDialogSize,
close_callback); close_callback);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment