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

Side by Side Diff: chrome/browser/ui/extensions/app_metro_infobar_delegate_win.h

Issue 12450014: Show an InfoBar when trying to start Packaged Apps from Metro mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: feedback Created 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_ 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_
6 #define CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_ 6 #define CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_
7 7
8 #include "base/string16.h" 8 #include "base/string16.h"
9 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 9 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "ui/base/window_open_disposition.h" 11 #include "ui/base/window_open_disposition.h"
12 12
13 class Profile; 13 class Profile;
14 14
15 namespace gfx { 15 namespace gfx {
16 class Image; 16 class Image;
17 } 17 }
18 18
19 namespace chrome { 19 namespace chrome {
20 20
21 // This infobar operates by opening a new tab on about:blank, showing an 21 // This infobar operates by opening a new tab on about:blank, showing an
22 // infobar offering to relaunch the browser in metro mode, and then relaunching 22 // infobar offering to relaunch the browser in metro mode, and then relaunching
23 // in Desktop mode if confirmed. 23 // in Desktop mode if confirmed.
24 class AppMetroInfoBarDelegateWin : public ConfirmInfoBarDelegate { 24 class AppMetroInfoBarDelegateWin : public ConfirmInfoBarDelegate {
25 public: 25 public:
26 // Creates an instance of the app metro infobar delegate, adds it to 26 enum Mode {
27 // |infobar_service|, and then activates metro mode. This CHECK()s to ensure 27 SHOW_APP_LIST,
28 // that it is only called while running in desktop mode. 28 LAUNCH_PACKAGED_APP
29 static void CreateAndActivateMetro(Profile* profile); 29 };
30
31 // Creates an instance of the app metro infobar delegate, adds it to a new
32 // browser tab, then activates Metro mode.
33 static void Create(Profile* profile,
34 Mode mode,
35 const std::string& extension_id);
30 36
31 private: 37 private:
32 explicit AppMetroInfoBarDelegateWin(InfoBarService* infobar_service); 38 explicit AppMetroInfoBarDelegateWin(InfoBarService* infobar_service,
39 Mode mode,
40 const std::string& extension_id);
33 virtual ~AppMetroInfoBarDelegateWin(); 41 virtual ~AppMetroInfoBarDelegateWin();
34 42
35 // ConfirmInfoBarDelegate overrides: 43 // ConfirmInfoBarDelegate overrides:
36 virtual gfx::Image* GetIcon() const OVERRIDE; 44 virtual gfx::Image* GetIcon() const OVERRIDE;
37 virtual string16 GetMessageText() const OVERRIDE; 45 virtual string16 GetMessageText() const OVERRIDE;
38 virtual int GetButtons() const OVERRIDE; 46 virtual int GetButtons() const OVERRIDE;
39 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 47 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
40 virtual bool Accept() OVERRIDE; 48 virtual bool Accept() OVERRIDE;
41 virtual bool Cancel() OVERRIDE; 49 virtual bool Cancel() OVERRIDE;
42 virtual string16 GetLinkText() const OVERRIDE; 50 virtual string16 GetLinkText() const OVERRIDE;
43 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 51 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
44 52
53 Mode mode_;
54 std::string extension_id_;
55
45 DISALLOW_COPY_AND_ASSIGN(AppMetroInfoBarDelegateWin); 56 DISALLOW_COPY_AND_ASSIGN(AppMetroInfoBarDelegateWin);
46 }; 57 };
47 58
59 } // namespace chrome
60
48 #endif // CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_ 61 #endif // CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_
49
50 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/extensions/platform_app_launcher.cc ('k') | chrome/browser/ui/extensions/app_metro_infobar_delegate_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698