Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: trunk/src/chrome/browser/ui/views/apps/native_app_window_views_win.cc

Issue 163963002: Revert 251029 "Move Windows-specific code into NativeAppWindowVi..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/chrome/browser/ui/views/apps/native_app_window_views_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/browser/ui/views/apps/native_app_window_views_win.cc
===================================================================
--- trunk/src/chrome/browser/ui/views/apps/native_app_window_views_win.cc (revision 251061)
+++ trunk/src/chrome/browser/ui/views/apps/native_app_window_views_win.cc (working copy)
@@ -7,65 +7,16 @@
#include "apps/shell_window.h"
#include "apps/shell_window_registry.h"
#include "ash/shell.h"
-#include "base/command_line.h"
-#include "base/file_util.h"
-#include "base/path_service.h"
-#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/apps/per_app_settings_service.h"
#include "chrome/browser/apps/per_app_settings_service_factory.h"
#include "chrome/browser/metro_utils/metro_chrome_win.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/web_applications/web_app_ui.h"
-#include "chrome/browser/web_applications/web_app.h"
-#include "chrome/browser/web_applications/web_app_win.h"
-#include "chrome/common/chrome_switches.h"
-#include "content/public/browser/browser_thread.h"
#include "extensions/common/extension.h"
#include "ui/aura/remote_root_window_host_win.h"
-#include "ui/base/win/shell.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
-#include "ui/views/win/hwnd_util.h"
-namespace {
-
-void CreateIconAndSetRelaunchDetails(
- const base::FilePath& web_app_path,
- const base::FilePath& icon_file,
- const ShellIntegration::ShortcutInfo& shortcut_info,
- const HWND hwnd) {
- DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread());
-
- // Set the relaunch data so "Pin this program to taskbar" has the app's
- // information.
- CommandLine command_line = ShellIntegration::CommandLineArgsForLauncher(
- shortcut_info.url,
- shortcut_info.extension_id,
- shortcut_info.profile_path);
-
- base::FilePath chrome_exe;
- if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
- NOTREACHED();
- return;
- }
- command_line.SetProgram(chrome_exe);
- ui::win::SetRelaunchDetailsForWindow(command_line.GetCommandLineString(),
- shortcut_info.title, hwnd);
-
- if (!base::PathExists(web_app_path) &&
- !base::CreateDirectory(web_app_path)) {
- return;
- }
-
- ui::win::SetAppIconForWindow(icon_file.value(), hwnd);
- web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon);
+NativeAppWindowViewsWin::NativeAppWindowViewsWin() {
}
-} // namespace
-
-NativeAppWindowViewsWin::NativeAppWindowViewsWin()
- : weak_ptr_factory_(this) {
-}
-
void NativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() {
if (!ash::Shell::HasInstance())
return;
@@ -83,31 +34,6 @@
}
}
-void NativeAppWindowViewsWin::OnShortcutInfoLoaded(
- const ShellIntegration::ShortcutInfo& shortcut_info) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
-
- HWND hwnd = GetNativeAppWindowHWND();
-
- // Set window's icon to the one we're about to create/update in the web app
- // path. The icon cache will refresh on icon creation.
- base::FilePath web_app_path = web_app::GetWebAppDataDirectory(
- shortcut_info.profile_path, shortcut_info.extension_id,
- shortcut_info.url);
- base::FilePath icon_file = web_app_path
- .Append(web_app::internals::GetSanitizedFileName(shortcut_info.title))
- .ReplaceExtension(FILE_PATH_LITERAL(".ico"));
-
- content::BrowserThread::PostBlockingPoolTask(
- FROM_HERE,
- base::Bind(&CreateIconAndSetRelaunchDetails,
- web_app_path, icon_file, shortcut_info, hwnd));
-}
-
-HWND NativeAppWindowViewsWin::GetNativeAppWindowHWND() const {
- return views::HWNDForWidget(window()->GetTopLevelWidget());
-}
-
void NativeAppWindowViewsWin::OnBeforeWidgetInit(
views::Widget::InitParams* init_params, views::Widget* widget) {
// If an app has any existing windows, ensure new ones are created on the
@@ -136,27 +62,6 @@
init_params->native_widget = new views::DesktopNativeWidgetAura(widget);
}
-void NativeAppWindowViewsWin::InitializeDefaultWindow(
- const apps::ShellWindow::CreateParams& create_params) {
- NativeAppWindowViews::InitializeDefaultWindow(create_params);
-
- std::string app_name =
- web_app::GenerateApplicationNameFromExtensionId(extension()->id());
- base::string16 app_name_wide = base::UTF8ToWide(app_name);
- HWND hwnd = GetNativeAppWindowHWND();
- ui::win::SetAppIdForWindow(
- ShellIntegration::GetAppModelIdForProfile(
- app_name_wide,
- Profile::FromBrowserContext(browser_context())->GetPath()),
- hwnd);
-
- web_app::UpdateShortcutInfoAndIconForApp(
- *extension(),
- Profile::FromBrowserContext(browser_context()),
- base::Bind(&NativeAppWindowViewsWin::OnShortcutInfoLoaded,
- weak_ptr_factory_.GetWeakPtr()));
-}
-
void NativeAppWindowViewsWin::Show() {
ActivateParentDesktopIfNecessary();
NativeAppWindowViews::Show();
« no previous file with comments | « trunk/src/chrome/browser/ui/views/apps/native_app_window_views_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698