diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 00:08:26 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-24 00:08:26 +0000 |
commit | f847e608f1cfead35cf71a3d254f116e54aa4294 (patch) | |
tree | 4b7f217c5733b8084c05bf6f7352189b55f82acc /chrome/browser/ui/views | |
parent | dd29bcd78feba27e2093d0b2cacbd6e9d8e314ef (diff) | |
download | chromium_src-f847e608f1cfead35cf71a3d254f116e54aa4294.zip chromium_src-f847e608f1cfead35cf71a3d254f116e54aa4294.tar.gz chromium_src-f847e608f1cfead35cf71a3d254f116e54aa4294.tar.bz2 |
Split off web_app's ui into ui files, plumb TCW rather than TC.
BUG=71097
TEST=none; no visible change
Review URL: http://codereview.chromium.org/6672059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79220 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/views')
5 files changed, 21 insertions, 13 deletions
diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h index 2bd98df..b3341734 100644 --- a/chrome/browser/ui/views/browser_dialogs.h +++ b/chrome/browser/ui/views/browser_dialogs.h @@ -25,6 +25,7 @@ class GURL; class InfoBubbleDelegate; class Profile; class TabContents; +class TabContentsWrapper; class TemplateURL; namespace gfx { @@ -87,7 +88,7 @@ void ShowCollectedCookiesDialog(gfx::NativeWindow parent_window, // Shows the create web app shortcut dialog box. void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, - TabContents* tab_contents); + TabContentsWrapper* tab_contents); // Shows the create chrome app shortcut dialog box. void ShowCreateChromeAppShortcutsDialog(gfx::NativeWindow parent_window, diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc index b722006..a2167fa 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.cc +++ b/chrome/browser/ui/views/create_application_shortcut_view.cc @@ -9,6 +9,8 @@ #include "base/win/windows_version.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" +#include "chrome/browser/ui/web_applications/web_app_ui.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_resource.h" @@ -191,7 +193,7 @@ void AppInfoView::OnPaint(gfx::Canvas* canvas) { namespace browser { void ShowCreateWebAppShortcutsDialog(gfx::NativeWindow parent_window, - TabContents* tab_contents) { + TabContentsWrapper* tab_contents) { views::Window::CreateChromeWindow(parent_window, gfx::Rect(), new CreateUrlApplicationShortcutView(tab_contents))->Show(); } @@ -407,13 +409,14 @@ void CreateApplicationShortcutView::ButtonPressed(views::Button* sender, } CreateUrlApplicationShortcutView::CreateUrlApplicationShortcutView( - TabContents* tab_contents) + TabContentsWrapper* tab_contents) : CreateApplicationShortcutView(tab_contents->profile()), tab_contents_(tab_contents), pending_download_(NULL) { web_app::GetShortcutInfoForTab(tab_contents_, &shortcut_info_); - const WebApplicationInfo& app_info = tab_contents_->web_app_info(); + const WebApplicationInfo& app_info = + tab_contents_->tab_contents()->web_app_info(); if (!app_info.icons.empty()) { web_app::GetIconsInfo(app_info, &unprocessed_icons_); FetchIcon(); @@ -431,9 +434,11 @@ bool CreateUrlApplicationShortcutView::Accept() { if (!CreateApplicationShortcutView::Accept()) return false; - tab_contents_->SetAppIcon(shortcut_info_.favicon); - if (tab_contents_->delegate()) - tab_contents_->delegate()->ConvertContentsToApplication(tab_contents_); + tab_contents_->tab_contents()->SetAppIcon(shortcut_info_.favicon); + if (tab_contents_->tab_contents()->delegate()) { + tab_contents_->tab_contents()->delegate()->ConvertContentsToApplication( + tab_contents_->tab_contents()); + } return true; } @@ -447,7 +452,7 @@ void CreateUrlApplicationShortcutView::FetchIcon() { pending_download_ = new IconDownloadCallbackFunctor(this); DCHECK(pending_download_); - tab_contents_->favicon_helper().DownloadImage( + tab_contents_->tab_contents()->favicon_helper().DownloadImage( unprocessed_icons_.back().url, std::max(unprocessed_icons_.back().width, unprocessed_icons_.back().height), diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h index f13b9e9..5f4efae 100644 --- a/chrome/browser/ui/views/create_application_shortcut_view.h +++ b/chrome/browser/ui/views/create_application_shortcut_view.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -25,6 +25,7 @@ class Extension; class MessageLoop; class Profile; class TabContents; +class TabContentsWrapper; // CreateShortcutViewCommon implements a dialog that asks user where to create // the shortcut for given web app. There are two variants of this dialog: @@ -84,7 +85,7 @@ class CreateApplicationShortcutView : public views::View, // Create an application shortcut pointing to a URL. class CreateUrlApplicationShortcutView : public CreateApplicationShortcutView { public: - explicit CreateUrlApplicationShortcutView(TabContents* tab_contents); + explicit CreateUrlApplicationShortcutView(TabContentsWrapper* tab_contents); virtual ~CreateUrlApplicationShortcutView(); virtual bool Accept(); @@ -98,7 +99,7 @@ class CreateUrlApplicationShortcutView : public CreateApplicationShortcutView { void OnIconDownloaded(bool errored, const SkBitmap& image); // The tab whose URL is being turned into an app. - TabContents* tab_contents_; + TabContentsWrapper* tab_contents_; // Pending app icon download tracked by us. class IconDownloadCallbackFunctor; diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index 97298b0..7f660b3 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -1131,7 +1131,8 @@ void BrowserView::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, browser::ShowHtmlDialog(parent, browser_.get()->profile(), delegate); } -void BrowserView::ShowCreateWebAppShortcutsDialog(TabContents* tab_contents) { +void BrowserView::ShowCreateWebAppShortcutsDialog( + TabContentsWrapper* tab_contents) { browser::ShowCreateWebAppShortcutsDialog(GetNativeHandle(), tab_contents); } diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h index a53fefa..4032e40 100644 --- a/chrome/browser/ui/views/frame/browser_view.h +++ b/chrome/browser/ui/views/frame/browser_view.h @@ -294,7 +294,7 @@ class BrowserView : public BrowserBubbleHost, bool* is_keyboard_shortcut) OVERRIDE; virtual void HandleKeyboardEvent(const NativeWebKeyboardEvent& event) OVERRIDE; - virtual void ShowCreateWebAppShortcutsDialog(TabContents* tab_contents) + virtual void ShowCreateWebAppShortcutsDialog(TabContentsWrapper* tab_contents) OVERRIDE; virtual void ShowCreateChromeAppShortcutsDialog( Profile*, const Extension* app) OVERRIDE; |