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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/tab_contents/customize_geoloc_infobar_delegate.cc
===================================================================
--- chrome/browser/tab_contents/customize_geoloc_infobar_delegate.cc (revision 0)
+++ chrome/browser/tab_contents/customize_geoloc_infobar_delegate.cc (revision 0)
@@ -0,0 +1,69 @@
+// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use
+// of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/gfx/gtk_util.h"
+#include "chrome/browser/gtk/infobar_gtk.h"
+#include "chrome/browser/tab_contents/customize_geoloc_infobar_delegate.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "webkit/chaos/GeolocationPowerbox.h"
+
+CustomizeGeolocInfoBarDelegate::CustomizeGeolocInfoBarDelegate(
+ TabContents* contents)
+ : ConfirmInfoBarDelegate(contents), contents_(contents) {
+ const double top[3] =
+ {66.0 / 255.0, 109.0 / 255.0, 201.0 / 255.0};
+ const double bottom[3] =
+ {99.0 / 255.0, 145.0 / 255.0, 222.0 / 255.0};
+ style_.reset(new InfoBarStyle(top, bottom, 280, gfx::kGdkWhite, false));
+}
+
+CustomizeGeolocInfoBarDelegate::~CustomizeGeolocInfoBarDelegate() {}
+
+std::wstring CustomizeGeolocInfoBarDelegate::GetGeolocButtonLabel(
+ GeolocButton button) const {
+ switch(button) {
+ case CustomizeGeolocInfoBarDelegate::BUTTON_BEST:
+ return std::wstring(L"Best available");
+ case CustomizeGeolocInfoBarDelegate::BUTTON_CITY:
+ return std::wstring(L"City level");
+ case CustomizeGeolocInfoBarDelegate::BUTTON_NONE:
+ return std::wstring(L"Hide your location");
+ default:
+ return std::wstring(L"");
+ }
+}
+
+SkBitmap* CustomizeGeolocInfoBarDelegate::GetGeolocButtonImage(
+ GeolocButton button) const {
+ switch(button) {
+ case CustomizeGeolocInfoBarDelegate::BUTTON_BEST:
+ return ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_INFOBAR_BEST_GEOLOC);
+ case CustomizeGeolocInfoBarDelegate::BUTTON_CITY:
+ return ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_INFOBAR_CITY_GEOLOC);
+ case CustomizeGeolocInfoBarDelegate::BUTTON_NONE:
+ return ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_INFOBAR_NO_GEOLOC);
+ default:
+ return NULL;
+ }
+}
+
+bool CustomizeGeolocInfoBarDelegate::OnGeolocButtonClick(
+ GeolocButton button) const {
+ switch(button) {
+ case CustomizeGeolocInfoBarDelegate::BUTTON_BEST:
+ contents_->GeolocationProviderChosen(
+ WebCore::GeolocationPowerbox::EXACT);
+ break;
+ case CustomizeGeolocInfoBarDelegate::BUTTON_CITY:
+ contents_->GeolocationProviderChosen(WebCore::GeolocationPowerbox::CITY);
+ break;
+ case CustomizeGeolocInfoBarDelegate::BUTTON_NONE:
+ contents_->GeolocationProviderChosen(WebCore::GeolocationPowerbox::NONE);
+ break;
+ }
+ return true;
+}
Property changes on: chrome/browser/tab_contents/customize_geoloc_infobar_delegate.cc
___________________________________________________________________
Added: svn:eol-style
+ LF
« 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