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

Side by Side Diff: chrome/browser/tab_contents/geoloc_infobar_delegate.h

Issue 160084: Chaos geolocation demo, non-WebKit part. Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 4 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use
2 // of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_TAB_CONTENTS_GEOLOC_INFOBAR_DELEGATE_H_
6 #define CHROME_BROWSER_TAB_CONTENTS_GEOLOC_INFOBAR_DELEGATE_H_
7
8 #include "app/resource_bundle.h"
9 #include "base/scoped_ptr.h"
10 #include "chrome/browser/gtk/infobar_gtk.h"
11 #include "chrome/browser/tab_contents/infobar_delegate.h"
12 #include "chrome/browser/tab_contents/tab_contents.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
14 #include "grit/theme_resources.h"
15
16 class TabContents;
17
18 class GeolocInfoBarDelegate : public ConfirmInfoBarDelegate {
19 public:
20 explicit GeolocInfoBarDelegate(TabContents* contents);
21
22 // Overridden from ConfirmInfoBarDelegate:
23 virtual void InfoBarClosed();
24
25 virtual std::wstring GetMessageText() const {
26 return std::wstring(L"<b>Do you want to do the thing "
27 "you just told me to do?</b>");
28 }
29 virtual std::wstring GetCustomizeText() const {
30 return std::wstring(L"<span color=\"white\">Customize</span>");
31 }
32 virtual std::wstring GetLearnMoreText() const {
33 return std::wstring(L"<span color=\"white\">Learn more</span>");
34 }
35 virtual SkBitmap* GetIcon() const {
36 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
37 IDR_INFOBAR_RESTORE_SESSION);
38 }
39 virtual int GetButtons() const {
40 return BUTTON_OK | BUTTON_CANCEL | BUTTON_OK_DEFAULT;
41 }
42 virtual std::wstring GetButtonLabel(InfoBarButton button) const {
43 return button == BUTTON_OK ?
44 std::wstring(L"Obviously") :
45 std::wstring(L"Shockingly, no");
46 }
47
48 // Overridden from InfoBarDelegate:
49 // Returns the desired styling attributes for this infobar.
50 virtual InfoBarStyle* GetStyle() const { return style_.get(); }
51
52 // Called when the Learn More link is clicked. The |disposition|
53 // specifies how the resulting document should be loaded (based
54 // on the event flags present when the link was clicked). This
55 // function returns true if the InfoBar should be closed now or
56 // false if it should remain until the user explicitly closes it.
57 virtual bool LearnMoreClicked(WindowOpenDisposition disposition) {
58 return true;
59 }
60 virtual bool CustomizeClicked(WindowOpenDisposition disposition) {
61 customize_clicked_ = true;
62 return true;
63 }
64
65 // Overridden from ConfirmInfoBarDelegate:
66 virtual InfoBar* CreateInfoBar();
67 virtual GeolocInfoBarDelegate* AsGeolocInfoBarDelegate() {
68 return this;
69 }
70 private:
71 scoped_ptr<InfoBarStyle> style_;
72
73 TabContents *parent_contents_;
74
75 bool customize_clicked_;
76 bool learn_more_clicked_;
77
78 DISALLOW_COPY_AND_ASSIGN(GeolocInfoBarDelegate);
79 };
80
81 #endif // CHROME_BROWSER_GEOLOC_GEOLOC_INFOBAR_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698