summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/net/url_fetcher.cc6
-rw-r--r--chrome/common/net/url_fetcher.h4
-rw-r--r--chrome/common/render_messages.cc23
-rw-r--r--chrome/common/render_messages.h12
-rw-r--r--chrome/common/render_messages_internal.h41
-rw-r--r--chrome/common/speech_input_messages.cc83
-rw-r--r--chrome/common/speech_input_messages.h93
7 files changed, 186 insertions, 76 deletions
diff --git a/chrome/common/net/url_fetcher.cc b/chrome/common/net/url_fetcher.cc
index 53487b7..e2aad81 100644
--- a/chrome/common/net/url_fetcher.cc
+++ b/chrome/common/net/url_fetcher.cc
@@ -127,6 +127,7 @@ class URLFetcher::Core
std::string upload_content_; // HTTP POST payload
std::string upload_content_type_; // MIME type of POST payload
+ std::string referrer_; // HTTP Referer header value
// Used to determine how long to wait before making a request or doing a
// retry.
@@ -336,6 +337,7 @@ void URLFetcher::Core::StartURLRequest() {
}
request_->set_load_flags(flags);
request_->set_context(request_context_getter_->GetURLRequestContext());
+ request_->set_referrer(referrer_);
switch (request_type_) {
case GET:
@@ -481,6 +483,10 @@ const std::string& URLFetcher::upload_data() const {
return core_->upload_content_;
}
+void URLFetcher::set_referrer(const std::string& referrer) {
+ core_->referrer_ = referrer;
+}
+
void URLFetcher::set_load_flags(int load_flags) {
core_->load_flags_ = load_flags;
}
diff --git a/chrome/common/net/url_fetcher.h b/chrome/common/net/url_fetcher.h
index dfa29a9..19edbb9 100644
--- a/chrome/common/net/url_fetcher.h
+++ b/chrome/common/net/url_fetcher.h
@@ -139,6 +139,10 @@ class URLFetcher {
// Returns the current load flags.
int load_flags() const;
+ // The referrer URL for the request. Must be called before the request is
+ // started.
+ void set_referrer(const std::string& referrer);
+
// Set extra headers on the request. Must be called before the request
// is started.
void set_extra_request_headers(const std::string& extra_request_headers);
diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc
index 981ef91..eaf1504 100644
--- a/chrome/common/render_messages.cc
+++ b/chrome/common/render_messages.cc
@@ -9,7 +9,6 @@
#include "chrome/common/gpu_param_traits.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/common/resource_response.h"
-#include "chrome/common/speech_input_result.h"
#include "chrome/common/thumbnail_score.h"
#include "chrome/common/web_apps.h"
#include "gfx/rect.h"
@@ -1220,28 +1219,6 @@ void ParamTraits<AudioBuffersState>::Log(const param_type& p, std::string* l) {
l->append(")");
}
-void ParamTraits<speech_input::SpeechInputResultItem>::Write(
- Message* m, const param_type& p) {
- WriteParam(m, p.utterance);
- WriteParam(m, p.confidence);
-}
-
-bool ParamTraits<speech_input::SpeechInputResultItem>::Read(const Message* m,
- void** iter,
- param_type* p) {
- return ReadParam(m, iter, &p->utterance) &&
- ReadParam(m, iter, &p->confidence);
-}
-
-void ParamTraits<speech_input::SpeechInputResultItem>::Log(const param_type& p,
- std::string* l) {
- l->append("(");
- LogParam(p.utterance, l);
- l->append(":");
- LogParam(p.confidence, l);
- l->append(")");
-}
-
void ParamTraits<PP_Flash_NetAddress>::Write(Message* m, const param_type& p) {
WriteParam(m, p.size);
m->WriteBytes(p.data, p.size);
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 2902124..b681f8f 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -48,10 +48,6 @@ namespace webkit_blob {
class BlobData;
}
-namespace speech_input {
-struct SpeechInputResultItem;
-}
-
namespace webkit_glue {
struct FormData;
class FormField;
@@ -557,14 +553,6 @@ struct ParamTraits<AudioBuffersState> {
};
template <>
-struct ParamTraits<speech_input::SpeechInputResultItem> {
- typedef speech_input::SpeechInputResultItem param_type;
- static void Write(Message* m, const param_type& p);
- static bool Read(const Message* m, void** iter, param_type* p);
- static void Log(const param_type& p, std::string* l);
-};
-
-template <>
struct ParamTraits<PP_Flash_NetAddress> {
typedef PP_Flash_NetAddress param_type;
static void Write(Message* m, const param_type& p);
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index 2a6f683..f2c588c 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -19,7 +19,6 @@
#include "chrome/common/nacl_types.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/page_zoom.h"
-#include "chrome/common/speech_input_result.h"
#include "chrome/common/translate_errors.h"
#include "chrome/common/window_container_type.h"
#include "ipc/ipc_message_macros.h"
@@ -1018,22 +1017,6 @@ IPC_MESSAGE_ROUTED1(ViewMsg_AccessibilityDoDefaultAction,
// message was processed and it can send addition notifications.
IPC_MESSAGE_ROUTED0(ViewMsg_AccessibilityNotifications_ACK)
-// Relay a speech recognition result, either partial or final.
-IPC_MESSAGE_ROUTED2(ViewMsg_SpeechInput_SetRecognitionResult,
- int /* request id */,
- speech_input::SpeechInputResultArray /* result */)
-
-// Indicate that speech recognizer has stopped recording and started
-// recognition.
-IPC_MESSAGE_ROUTED1(ViewMsg_SpeechInput_RecordingComplete,
- int /* request id */)
-
-// Indicate that speech recognizer has completed recognition. This will be
-// the last message sent in response to a
-// ViewHostMsg_SpeechInput_StartRecognition.
-IPC_MESSAGE_ROUTED1(ViewMsg_SpeechInput_RecognitionComplete,
- int /* request id */)
-
// Notification that the device's orientation has changed.
IPC_MESSAGE_ROUTED1(ViewMsg_DeviceOrientationUpdated,
ViewMsg_DeviceOrientationUpdated_Params)
@@ -2462,30 +2445,6 @@ IPC_MESSAGE_ROUTED3(ViewHostMsg_UpdateZoomLimits,
int /* maximum_percent */,
bool /* remember */)
-// Requests the speech input service to start speech recognition on behalf of
-// the given |render_view_id|.
-IPC_MESSAGE_CONTROL5(ViewHostMsg_SpeechInput_StartRecognition,
- int /* render_view_id */,
- int /* request_id */,
- gfx::Rect /* element_rect */,
- std::string /* language */,
- std::string /* grammar */)
-
-// Requests the speech input service to cancel speech recognition on behalf of
-// the given |render_view_id|. If speech recognition is not happening nor or
-// is happening on behalf of some other render view, this call does nothing.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_SpeechInput_CancelRecognition,
- int /* render_view_id */,
- int /* request id */)
-
-// Requests the speech input service to stop audio recording on behalf of
-// the given |render_view_id|. Any audio recorded so far will be fed to the
-// speech recognizer. If speech recognition is not happening nor or is
-// happening on behalf of some other render view, this call does nothing.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_SpeechInput_StopRecording,
- int /* render_view_id */,
- int /* request id */)
-
//---------------------------------------------------------------------------
// Device orientation services messages:
diff --git a/chrome/common/speech_input_messages.cc b/chrome/common/speech_input_messages.cc
new file mode 100644
index 0000000..c93062f
--- /dev/null
+++ b/chrome/common/speech_input_messages.cc
@@ -0,0 +1,83 @@
+// Copyright (c) 2011 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 "chrome/common/common_param_traits.h"
+
+#define IPC_MESSAGE_IMPL
+#include "chrome/common/speech_input_messages.h"
+
+SpeechInputHostMsg_StartRecognition_Params::
+SpeechInputHostMsg_StartRecognition_Params()
+ : render_view_id(0),
+ request_id(0) {
+}
+
+SpeechInputHostMsg_StartRecognition_Params::
+~SpeechInputHostMsg_StartRecognition_Params() {
+}
+
+namespace IPC {
+
+void ParamTraits<speech_input::SpeechInputResultItem>::Write(
+ Message* m, const param_type& p) {
+ WriteParam(m, p.utterance);
+ WriteParam(m, p.confidence);
+}
+
+bool ParamTraits<speech_input::SpeechInputResultItem>::Read(const Message* m,
+ void** iter,
+ param_type* p) {
+ return ReadParam(m, iter, &p->utterance) &&
+ ReadParam(m, iter, &p->confidence);
+}
+
+void ParamTraits<speech_input::SpeechInputResultItem>::Log(const param_type& p,
+ std::string* l) {
+ l->append("(");
+ LogParam(p.utterance, l);
+ l->append(":");
+ LogParam(p.confidence, l);
+ l->append(")");
+}
+
+void ParamTraits<SpeechInputHostMsg_StartRecognition_Params>::Write(
+ Message* m,
+ const param_type& p) {
+ WriteParam(m, p.render_view_id);
+ WriteParam(m, p.request_id);
+ WriteParam(m, p.element_rect);
+ WriteParam(m, p.language);
+ WriteParam(m, p.grammar);
+ WriteParam(m, p.origin_url);
+}
+
+bool ParamTraits<SpeechInputHostMsg_StartRecognition_Params>::Read(
+ const Message* m, void** iter, param_type* p) {
+ return
+ ReadParam(m, iter, &p->render_view_id) &&
+ ReadParam(m, iter, &p->request_id) &&
+ ReadParam(m, iter, &p->element_rect) &&
+ ReadParam(m, iter, &p->language) &&
+ ReadParam(m, iter, &p->grammar) &&
+ ReadParam(m, iter, &p->origin_url);
+}
+
+void ParamTraits<SpeechInputHostMsg_StartRecognition_Params>::Log(
+ const param_type& p, std::string* l) {
+ l->append("(");
+ LogParam(p.render_view_id, l);
+ l->append(", ");
+ LogParam(p.request_id, l);
+ l->append(", ");
+ LogParam(p.element_rect, l);
+ l->append(", ");
+ LogParam(p.language, l);
+ l->append(", ");
+ LogParam(p.grammar, l);
+ l->append(", ");
+ LogParam(p.origin_url, l);
+ l->append(")");
+}
+
+} // namespace IPC
diff --git a/chrome/common/speech_input_messages.h b/chrome/common/speech_input_messages.h
new file mode 100644
index 0000000..2a856e5
--- /dev/null
+++ b/chrome/common/speech_input_messages.h
@@ -0,0 +1,93 @@
+// Copyright (c) 2011 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.
+
+#ifndef CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_
+#define CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_
+#pragma once
+
+#include "chrome/common/speech_input_result.h"
+#include "gfx/rect.h"
+#include "ipc/ipc_message_macros.h"
+#include "ipc/ipc_param_traits.h"
+
+#define IPC_MESSAGE_START SpeechInputMsgStart
+
+namespace speech_input {
+struct SpeechInputResultItem;
+}
+
+// Used to start a speech recognition session.
+struct SpeechInputHostMsg_StartRecognition_Params {
+ SpeechInputHostMsg_StartRecognition_Params();
+ ~SpeechInputHostMsg_StartRecognition_Params();
+
+ int render_view_id; // The render view requesting speech recognition.
+ int request_id; // Request ID used within the render view.
+ gfx::Rect element_rect; // Position of the UI element in page coordinates.
+ std::string language; // Language to use for speech recognition.
+ std::string grammar; // Speech grammar given by the speech input element.
+ std::string origin_url; // URL of the page (or iframe if applicable).
+};
+
+namespace IPC {
+
+template <>
+struct ParamTraits<speech_input::SpeechInputResultItem> {
+ typedef speech_input::SpeechInputResultItem param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
+template <>
+struct ParamTraits<SpeechInputHostMsg_StartRecognition_Params> {
+ typedef SpeechInputHostMsg_StartRecognition_Params param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
+} // namespace IPC
+
+// Speech input messages sent from the renderer to the browser.
+
+// Requests the speech input service to start speech recognition on behalf of
+// the given |render_view_id|.
+IPC_MESSAGE_CONTROL1(SpeechInputHostMsg_StartRecognition,
+ SpeechInputHostMsg_StartRecognition_Params)
+
+// Requests the speech input service to cancel speech recognition on behalf of
+// the given |render_view_id|. If speech recognition is not happening or
+// is happening on behalf of some other render view, this call does nothing.
+IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_CancelRecognition,
+ int /* render_view_id */,
+ int /* request_id */)
+
+// Requests the speech input service to stop audio recording on behalf of
+// the given |render_view_id|. Any audio recorded so far will be fed to the
+// speech recognizer. If speech recognition is not happening nor or is
+// happening on behalf of some other render view, this call does nothing.
+IPC_MESSAGE_CONTROL2(SpeechInputHostMsg_StopRecording,
+ int /* render_view_id */,
+ int /* request_id */)
+
+// Speech input messages sent from the browser to the renderer.
+
+// Relay a speech recognition result, either partial or final.
+IPC_MESSAGE_ROUTED2(SpeechInputMsg_SetRecognitionResult,
+ int /* request_id */,
+ speech_input::SpeechInputResultArray /* result */)
+
+// Indicate that speech recognizer has stopped recording and started
+// recognition.
+IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecordingComplete,
+ int /* request_id */)
+
+// Indicate that speech recognizer has completed recognition. This will be
+// the last message sent in response to a
+// ViewHostMsg_SpeechInput_StartRecognition.
+IPC_MESSAGE_ROUTED1(SpeechInputMsg_RecognitionComplete,
+ int /* request_id */)
+
+#endif // CHROME_COMMON_SPEECH_INPUT_MESSAGES_H_