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

Unified Diff: chrome/browser/ui/views/create_application_shortcut_view.h

Issue 2772713002: Remove IDC_CREATE_SHORTCUT and its associated UI. (Closed)
Patch Set: Fix compile Created 3 years, 9 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
Index: chrome/browser/ui/views/create_application_shortcut_view.h
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.h b/chrome/browser/ui/views/create_application_shortcut_view.h
index 07d45c12167426baff53c24602f1be7c7305e0d6..094429ff9ab54a540ab6b0ab2de52d21afb7f730 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.h
+++ b/chrome/browser/ui/views/create_application_shortcut_view.h
@@ -6,22 +6,14 @@
#define CHROME_BROWSER_UI_VIEWS_CREATE_APPLICATION_SHORTCUT_VIEW_H_
#include <memory>
-#include <string>
-#include <vector>
-#include "base/compiler_specific.h"
#include "base/macros.h"
dominickn 2017/04/03 03:10:00 #include "base/callback.h"
tapted 2017/04/04 01:30:39 Done.
+#include "base/strings/string16.h"
dominickn 2017/04/03 03:10:00 #include "base/memory/weak_ptr.h"
tapted 2017/04/04 01:30:39 Done.
#include "chrome/browser/web_applications/web_app.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/window/dialog_delegate.h"
-class GURL;
class Profile;
-class SkBitmap;
-
-namespace content {
-class WebContents;
-}
namespace extensions {
class Extension;
@@ -32,29 +24,18 @@ class Checkbox;
class Label;
}
-// CreateShortcutViewCommon implements a dialog that asks user where to create
-// the shortcut for given web app. There are two variants of this dialog:
-// Shortcuts that load a URL in an app-like window, and shortcuts that load
-// a chrome app (the kind you see under "apps" on the new tabs page) in an app
-// window. These are implemented as subclasses of CreateShortcutViewCommon.
-class CreateApplicationShortcutView : public views::DialogDelegateView,
- public views::ButtonListener {
+// Create an application shortcut pointing to a chrome application.
+class CreateChromeApplicationShortcutView : public views::DialogDelegateView,
+ public views::ButtonListener {
public:
- enum DialogLayout {
- // URL shortcuts have an info frame at the top with a thumbnail, title and
- // description.
- DIALOG_LAYOUT_URL_SHORTCUT,
-
- // App shortcuts don't have an info frame, since they are launched from
- // places where it's clear what app they are from.
- DIALOG_LAYOUT_APP_SHORTCUT
- };
-
- explicit CreateApplicationShortcutView(Profile* profile);
- ~CreateApplicationShortcutView() override;
+ CreateChromeApplicationShortcutView(
+ Profile* profile,
+ const extensions::Extension* app,
+ const base::Callback<void(bool)>& close_callback);
+ ~CreateChromeApplicationShortcutView() override;
// Initialize the controls on the dialog.
- void InitControls(DialogLayout dialog_layout);
+ void InitControls();
// Overridden from views::View:
gfx::Size GetPreferredSize() const override;
@@ -65,86 +46,33 @@ class CreateApplicationShortcutView : public views::DialogDelegateView,
ui::ModalType GetModalType() const override;
base::string16 GetWindowTitle() const override;
bool Accept() override;
+ bool Cancel() override;
- // Overridden from views::ButtonListener:
- void ButtonPressed(views::Button* sender, const ui::Event& event) override;
-
- protected:
+ private:
// Adds a new check-box as a child to the view.
views::Checkbox* AddCheckbox(const base::string16& text, bool checked);
+ // Called when the app's ShortcutInfo (with icon) is loaded.
+ void OnAppInfoLoaded(std::unique_ptr<web_app::ShortcutInfo> shortcut_info);
+
+ // Overridden from views::ButtonListener:
+ void ButtonPressed(views::Button* sender, const ui::Event& event) override;
+
// Profile in which the shortcuts will be created.
Profile* profile_;
+ base::Callback<void(bool)> close_callback_;
+
// UI elements on the dialog.
- // May be NULL if we are not displaying the app's info.
- views::View* app_info_;
views::Label* create_shortcuts_label_;
+
+ // May be null if the platform doesn't support a particular location.
views::Checkbox* desktop_check_box_;
views::Checkbox* menu_check_box_;
views::Checkbox* quick_launch_check_box_;
// Target shortcut and file handler info.
std::unique_ptr<web_app::ShortcutInfo> shortcut_info_;
- // If false, the shortcut will be created in the root level of the Start Menu.
- bool create_in_chrome_apps_subdir_;
-
- DISALLOW_COPY_AND_ASSIGN(CreateApplicationShortcutView);
-};
-
-// Create an application shortcut pointing to a URL.
-class CreateUrlApplicationShortcutView : public CreateApplicationShortcutView {
- public:
- explicit CreateUrlApplicationShortcutView(content::WebContents* web_contents);
- ~CreateUrlApplicationShortcutView() override;
-
- bool Accept() override;
-
- private:
- // Fetch the largest unprocessed icon.
- // The first largest icon downloaded and decoded successfully will be used.
- void FetchIcon();
-
- // Favicon download callback.
- void DidDownloadFavicon(
- int requested_size,
- int id,
- int http_status_code,
- const GURL& image_url,
- const std::vector<SkBitmap>& bitmaps,
- const std::vector<gfx::Size>& original_bitmap_sizes);
-
- // The tab whose URL is being turned into an app.
- content::WebContents* web_contents_;
-
- // Pending app icon download tracked by us.
- int pending_download_id_;
-
- // Unprocessed icons from the WebApplicationInfo passed in.
- web_app::IconInfoList unprocessed_icons_;
-
- base::WeakPtrFactory<CreateUrlApplicationShortcutView> weak_ptr_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(CreateUrlApplicationShortcutView);
-};
-
-// Create an application shortcut pointing to a chrome application.
-class CreateChromeApplicationShortcutView
- : public CreateApplicationShortcutView {
- public:
- CreateChromeApplicationShortcutView(
- Profile* profile,
- const extensions::Extension* app,
- const base::Callback<void(bool)>& close_callback);
- ~CreateChromeApplicationShortcutView() override;
- bool Accept() override;
- bool Cancel() override;
-
- private:
- // Called when the app's ShortcutInfo (with icon) is loaded.
- void OnAppInfoLoaded(std::unique_ptr<web_app::ShortcutInfo> shortcut_info);
-
- base::Callback<void(bool)> close_callback_;
base::WeakPtrFactory<CreateChromeApplicationShortcutView> weak_ptr_factory_;

Powered by Google App Engine
This is Rietveld 408576698