summaryrefslogtreecommitdiffstats
path: root/webkit/glue/webkitclient_impl.cc
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-01-07 14:18:56 +0000
committerBen Murdoch <benm@google.com>2011-01-11 10:23:13 +0000
commit201ade2fbba22bfb27ae029f4d23fca6ded109a0 (patch)
treeb793f4ed916f73cf18357ea467ff3deb5ffb5b52 /webkit/glue/webkitclient_impl.cc
parentd8c4c37a7d0961944bfdfaa117d5c68c8e129c97 (diff)
downloadexternal_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.zip
external_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.tar.gz
external_chromium-201ade2fbba22bfb27ae029f4d23fca6ded109a0.tar.bz2
Merge chromium at 9.0.597.55: Initial merge by git.
Change-Id: Id686a88437441ec7e17abb3328a404c7b6c3c6ad
Diffstat (limited to 'webkit/glue/webkitclient_impl.cc')
-rw-r--r--webkit/glue/webkitclient_impl.cc83
1 files changed, 76 insertions, 7 deletions
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 0c5766a..12d5702 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -16,6 +16,7 @@
#include "base/lock.h"
#include "base/message_loop.h"
#include "base/metrics/stats_counters.h"
+#include "base/metrics/histogram.h"
#include "base/process_util.h"
#include "base/platform_file.h"
#include "base/singleton.h"
@@ -156,10 +157,36 @@ static int ToMessageID(WebLocalizedString::Name name) {
return IDS_KEYGEN_HIGH_GRADE_KEY;
case WebLocalizedString::KeygenMenuMediumGradeKeySize:
return IDS_KEYGEN_MED_GRADE_KEY;
- // TODO(tkent): Remove default: when we merge the next
- // WebLocalizedString.h change.
- default:
- break;
+ case WebLocalizedString::ValidationValueMissing:
+ return IDS_FORM_VALIDATION_VALUE_MISSING;
+ case WebLocalizedString::ValidationValueMissingForCheckbox:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_CHECKBOX;
+ case WebLocalizedString::ValidationValueMissingForFile:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_FILE;
+ case WebLocalizedString::ValidationValueMissingForMultipleFile:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_MULTIPLE_FILE;
+ case WebLocalizedString::ValidationValueMissingForRadio:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_RADIO;
+ case WebLocalizedString::ValidationValueMissingForSelect:
+ return IDS_FORM_VALIDATION_VALUE_MISSING_SELECT;
+ case WebLocalizedString::ValidationTypeMismatch:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH;
+ case WebLocalizedString::ValidationTypeMismatchForEmail:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH_EMAIL;
+ case WebLocalizedString::ValidationTypeMismatchForMultipleEmail:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH_MULTIPLE_EMAIL;
+ case WebLocalizedString::ValidationTypeMismatchForURL:
+ return IDS_FORM_VALIDATION_TYPE_MISMATCH_URL;
+ case WebLocalizedString::ValidationPatternMismatch:
+ return IDS_FORM_VALIDATION_PATTERN_MISMATCH;
+ case WebLocalizedString::ValidationTooLong:
+ return IDS_FORM_VALIDATION_TOO_LONG;
+ case WebLocalizedString::ValidationRangeUnderflow:
+ return IDS_FORM_VALIDATION_RANGE_UNDERFLOW;
+ case WebLocalizedString::ValidationRangeOverflow:
+ return IDS_FORM_VALIDATION_RANGE_OVERFLOW;
+ case WebLocalizedString::ValidationStepMismatch:
+ return IDS_FORM_VALIDATION_STEP_MISMATCH;
}
return -1;
}
@@ -228,6 +255,30 @@ void WebKitClientImpl::incrementStatsCounter(const char* name) {
base::StatsCounter(name).Increment();
}
+void WebKitClientImpl::histogramCustomCounts(
+ const char* name, int sample, int min, int max, int bucket_count) {
+ // Copied from histogram macro, but without the static variable caching
+ // the histogram because name is dynamic.
+ scoped_refptr<base::Histogram> counter =
+ base::Histogram::FactoryGet(name, min, max, bucket_count,
+ base::Histogram::kUmaTargetedHistogramFlag);
+ DCHECK_EQ(name, counter->histogram_name());
+ if (counter.get())
+ counter->Add(sample);
+}
+
+void WebKitClientImpl::histogramEnumeration(
+ const char* name, int sample, int boundary_value) {
+ // Copied from histogram macro, but without the static variable caching
+ // the histogram because name is dynamic.
+ scoped_refptr<base::Histogram> counter =
+ base::LinearHistogram::FactoryGet(name, 1, boundary_value,
+ boundary_value + 1, base::Histogram::kUmaTargetedHistogramFlag);
+ DCHECK_EQ(name, counter->histogram_name());
+ if (counter.get())
+ counter->Add(sample);
+}
+
void WebKitClientImpl::traceEventBegin(const char* name, void* id,
const char* extra) {
TRACE_EVENT_BEGIN(name, id, extra);
@@ -311,12 +362,30 @@ WebString WebKitClientImpl::queryLocalizedString(
WebString WebKitClientImpl::queryLocalizedString(
WebLocalizedString::Name name, int numeric_value) {
+ return queryLocalizedString(name, base::IntToString16(numeric_value));
+}
+
+WebString WebKitClientImpl::queryLocalizedString(
+ WebLocalizedString::Name name, const WebString& value) {
+ int message_id = ToMessageID(name);
+ if (message_id < 0)
+ return WebString();
+ return ReplaceStringPlaceholders(GetLocalizedString(message_id), value, NULL);
+}
+
+WebString WebKitClientImpl::queryLocalizedString(
+ WebLocalizedString::Name name,
+ const WebString& value1,
+ const WebString& value2) {
int message_id = ToMessageID(name);
if (message_id < 0)
return WebString();
- return ReplaceStringPlaceholders(GetLocalizedString(message_id),
- base::IntToString16(numeric_value),
- NULL);
+ std::vector<string16> values;
+ values.reserve(2);
+ values.push_back(value1);
+ values.push_back(value2);
+ return ReplaceStringPlaceholders(
+ GetLocalizedString(message_id), values, NULL);
}
double WebKitClientImpl::currentTime() {