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

Side by Side Diff: chrome/browser/tab_contents/customize_geoloc_infobar_delegate.cc

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 #include "base/gfx/gtk_util.h"
6 #include "chrome/browser/gtk/infobar_gtk.h"
7 #include "chrome/browser/tab_contents/customize_geoloc_infobar_delegate.h"
8 #include "chrome/browser/tab_contents/tab_contents.h"
9 #include "webkit/chaos/GeolocationPowerbox.h"
10
11 CustomizeGeolocInfoBarDelegate::CustomizeGeolocInfoBarDelegate(
12 TabContents* contents)
13 : ConfirmInfoBarDelegate(contents), contents_(contents) {
14 const double top[3] =
15 {66.0 / 255.0, 109.0 / 255.0, 201.0 / 255.0};
16 const double bottom[3] =
17 {99.0 / 255.0, 145.0 / 255.0, 222.0 / 255.0};
18 style_.reset(new InfoBarStyle(top, bottom, 280, gfx::kGdkWhite, false));
19 }
20
21 CustomizeGeolocInfoBarDelegate::~CustomizeGeolocInfoBarDelegate() {}
22
23 std::wstring CustomizeGeolocInfoBarDelegate::GetGeolocButtonLabel(
24 GeolocButton button) const {
25 switch(button) {
26 case CustomizeGeolocInfoBarDelegate::BUTTON_BEST:
27 return std::wstring(L"Best available");
28 case CustomizeGeolocInfoBarDelegate::BUTTON_CITY:
29 return std::wstring(L"City level");
30 case CustomizeGeolocInfoBarDelegate::BUTTON_NONE:
31 return std::wstring(L"Hide your location");
32 default:
33 return std::wstring(L"");
34 }
35 }
36
37 SkBitmap* CustomizeGeolocInfoBarDelegate::GetGeolocButtonImage(
38 GeolocButton button) const {
39 switch(button) {
40 case CustomizeGeolocInfoBarDelegate::BUTTON_BEST:
41 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
42 IDR_INFOBAR_BEST_GEOLOC);
43 case CustomizeGeolocInfoBarDelegate::BUTTON_CITY:
44 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
45 IDR_INFOBAR_CITY_GEOLOC);
46 case CustomizeGeolocInfoBarDelegate::BUTTON_NONE:
47 return ResourceBundle::GetSharedInstance().GetBitmapNamed(
48 IDR_INFOBAR_NO_GEOLOC);
49 default:
50 return NULL;
51 }
52 }
53
54 bool CustomizeGeolocInfoBarDelegate::OnGeolocButtonClick(
55 GeolocButton button) const {
56 switch(button) {
57 case CustomizeGeolocInfoBarDelegate::BUTTON_BEST:
58 contents_->GeolocationProviderChosen(
59 WebCore::GeolocationPowerbox::EXACT);
60 break;
61 case CustomizeGeolocInfoBarDelegate::BUTTON_CITY:
62 contents_->GeolocationProviderChosen(WebCore::GeolocationPowerbox::CITY);
63 break;
64 case CustomizeGeolocInfoBarDelegate::BUTTON_NONE:
65 contents_->GeolocationProviderChosen(WebCore::GeolocationPowerbox::NONE);
66 break;
67 }
68 return true;
69 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/customize_geoloc_infobar_delegate.h ('k') | chrome/browser/tab_contents/geoloc_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698