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

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: handle flakiness 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/api/infobars/confirm_infobar_delegate.h" 9 #include "chrome/browser/api/infobars/confirm_infobar_delegate.h"
10 #include "chrome/browser/api/infobars/infobar_service.h" 10 #include "chrome/browser/api/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 // Creates an instance of the app metro infobar delegate, adds it to
27 // |infobar_service|, and then activates metro mode. This CHECK()s to ensure 27 // |infobar_service|, and then activates metro mode. This CHECK()s to ensure
28 // that it is only called while running in desktop mode. 28 // that it is only called while running in desktop mode.
29 static void CreateAndActivateMetro(Profile* profile); 29 static void CreateAndActivateMetroForAppList(Profile* profile);
benwells 2013/03/18 22:16:47 This is a mouthful. Is the CreateAndActivateMetro
tapted 2013/03/19 02:49:05 Most info bars just have a static 'Create()'. This
30 static void CreateAndActivateMetroForApp(Profile* profile,
31 const std::string& extension_id);
32
33 virtual ~AppMetroInfoBarDelegateWin();
30 34
31 private: 35 private:
32 explicit AppMetroInfoBarDelegateWin(InfoBarService* infobar_service); 36 enum Mode {
33 virtual ~AppMetroInfoBarDelegateWin(); 37 SHOW_APP_LIST,
38 LAUNCH_PACKAGED_APP
39 };
40
41 explicit AppMetroInfoBarDelegateWin(InfoBarService* infobar_service,
42 Mode mode,
43 const std::string& extension_id);
34 44
35 // ConfirmInfoBarDelegate overrides: 45 // ConfirmInfoBarDelegate overrides:
36 virtual gfx::Image* GetIcon() const OVERRIDE; 46 virtual gfx::Image* GetIcon() const OVERRIDE;
37 virtual string16 GetMessageText() const OVERRIDE; 47 virtual string16 GetMessageText() const OVERRIDE;
38 virtual int GetButtons() const OVERRIDE; 48 virtual int GetButtons() const OVERRIDE;
39 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; 49 virtual string16 GetButtonLabel(InfoBarButton button) const OVERRIDE;
40 virtual bool Accept() OVERRIDE; 50 virtual bool Accept() OVERRIDE;
41 virtual bool Cancel() OVERRIDE; 51 virtual bool Cancel() OVERRIDE;
42 virtual string16 GetLinkText() const OVERRIDE; 52 virtual string16 GetLinkText() const OVERRIDE;
43 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE; 53 virtual bool LinkClicked(WindowOpenDisposition disposition) OVERRIDE;
44 54
55 static void CreateAndActivateMetroHelper(
56 Profile* profile, Mode mode, const std::string& extension_id);
57
58 Mode mode_;
59 std::string extension_id_;
60
45 DISALLOW_COPY_AND_ASSIGN(AppMetroInfoBarDelegateWin); 61 DISALLOW_COPY_AND_ASSIGN(AppMetroInfoBarDelegateWin);
46 }; 62 };
47 63
64 } // namespace chrome
65
48 #endif // CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_ 66 #endif // CHROME_BROWSER_UI_EXTENSIONS_APP_METRO_INFOBAR_DELEGATE_WIN_H_
49
50 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698