Hello andreip,

I'd like you to do a code review.  Please execute
        g4 diff -c 8255929

or point your web browser to
        http://mondrian/8255929

to review the following code:

Change 8255929 by [EMAIL PROTECTED] on 2008/09/12 17:06:53 *pending*

        Sets Content-Type header for Geolocation network requests.
        
        R=andreip
        [EMAIL PROTECTED]
        DELTA=59  (59 added, 0 deleted, 0 changed)
        OCL=8255929

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/geolocation/network_location_request.cc#24
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/common/http_constants.cc#8
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/common/http_constants.h#7
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.cc#15
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.h#8
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.cc#12 
edit
... 
//depot/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.h#7 
edit
... 
//depot/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.cc#14
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.h#9 
edit
... 
//depot/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.h#6
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.mm#12
 edit

59 delta lines: 59 added, 0 deleted, 0 changed

Also consider running:
        g4 lint -c 8255929

which verifies that the changelist doesn't introduce new style violations.

If you can't do the review, please let me know as soon as possible.  During
your review, please ensure that all new code has corresponding unit tests and
that existing unit tests are updated appropriately.  Visit
http://www/eng/code_review.html for more information.

This is a semiautomated message from "g4 mail".  Complaints or suggestions?
Mail [EMAIL PROTECTED]
Change 8255929 by [EMAIL PROTECTED] on 2008/09/12 17:06:53 *pending*

        Sets Content-Type header for Geolocation network requests.

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/geolocation/network_location_request.cc#24
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/common/http_constants.cc#8
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/common/http_constants.h#7
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.cc#15
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.h#8
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.cc#12 
edit
... 
//depot/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.h#7 
edit
... 
//depot/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.cc#14
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.h#9 
edit
... 
//depot/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.h#6
 edit
... 
//depot/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.mm#12
 edit

==== 
//depot/googleclient/gears/opensource/gears/geolocation/network_location_request.cc#24
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/geolocation/network_location_request.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/geolocation/network_location_request.cc 
2008-09-05 18:40:21.000000000 +0100
+++ googleclient/gears/opensource/gears/geolocation/network_location_request.cc 
2008-09-12 18:38:23.000000000 +0100
@@ -119,6 +119,7 @@
   bool result = HttpPost(url_.c_str(),
                          false,            // Not capturing, so follow 
redirects
                          NULL,             // reason_header_value
+                         HttpConstants::kMimeApplicationJson,  // Content-Type
                          NULL,             // mod_since_date
                          NULL,             // required_cookie
                          true,             // disable_browser_cookies
==== 
//depot/googleclient/gears/opensource/gears/localserver/common/http_constants.cc#8
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/common/http_constants.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/common/http_constants.cc    
2008-09-12 17:06:48.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/common/http_constants.cc    
2008-09-12 17:06:58.000000000 +0100
@@ -56,6 +56,8 @@
 const char16 *HttpConstants::kMimeTextPlain = STRING16(L"text/plain");
 const char16 *HttpConstants::kMimeApplicationOctetStream =
                                  STRING16(L"application/octet-stream");
+const char16 *HttpConstants::kMimeApplicationJson =
+                                 STRING16(L"application/json");
 const char16 *HttpConstants::kNoCache = STRING16(L"no-cache");
 const char16 *HttpConstants::kOKStatusLine = STRING16(L"HTTP/1.1 200 OK");
 const char16 *HttpConstants::kPragmaHeader = STRING16(L"Pragma");
==== 
//depot/googleclient/gears/opensource/gears/localserver/common/http_constants.h#7
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/common/http_constants.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/common/http_constants.h     
2008-09-12 17:06:48.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/common/http_constants.h     
2008-09-12 17:07:02.000000000 +0100
@@ -72,6 +72,7 @@
   static const char16 *kLocationHeader;
   static const char16 *kMimeTextPlain;
   static const char16 *kMimeApplicationOctetStream;
+  static const char16 *kMimeApplicationJson;
   static const char16 *kNoCache;
   static const char16 *kOKStatusLine;
   static const char16 *kPragmaHeader;
==== 
//depot/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.cc#15
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.cc    
2008-09-12 19:05:53.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.cc    
2008-09-12 19:00:14.000000000 +0100
@@ -225,6 +225,7 @@
   const char16 *full_url;
   bool is_capturing;
   const char16 *reason_header_value;
+  const char16 *content_type_header_value;
   const char16 *if_mod_since_date;
   const char16 *required_cookie;
   bool disable_browser_cookies;
@@ -257,6 +258,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         NULL,  // content_type_header_value
                          if_mod_since_date,
                          required_cookie,
                          false,
@@ -274,6 +276,7 @@
 bool AsyncTask::HttpPost(const char16 *full_url,
                          bool is_capturing,
                          const char16 *reason_header_value,
+                         const char16 *content_type_header_value,
                          const char16 *if_mod_since_date,
                          const char16 *required_cookie,
                          bool disable_browser_cookies,
@@ -287,6 +290,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         content_type_header_value,
                          if_mod_since_date,
                          required_cookie,
                          disable_browser_cookies,
@@ -305,6 +309,7 @@
                                 const char16 *full_url,
                                 bool is_capturing,
                                 const char16 *reason_header_value,
+                                const char16 *content_type_header_value,
                                 const char16 *if_mod_since_date,
                                 const char16 *required_cookie,
                                 bool disable_browser_cookies,
@@ -349,6 +354,7 @@
   params.full_url = full_url;
   params.is_capturing = is_capturing;
   params.reason_header_value = reason_header_value;
+  params.content_type_header_value = content_type_header_value;
   params.if_mod_since_date = if_mod_since_date;
   params.required_cookie = required_cookie;
   params.disable_browser_cookies = disable_browser_cookies;
@@ -422,6 +428,14 @@
   if (params_->reason_header_value && params_->reason_header_value[0]) {
     if (!http_request->SetRequestHeader(HttpConstants::kXGearsReasonHeader,
                                         params_->reason_header_value)) {
+      return false;
+    }
+  }
+
+  if (params_->content_type_header_value &&
+      params_->content_type_header_value[0]) {
+    if (!http_request->SetRequestHeader(HttpConstants::kContentTypeHeader,
+                                        params_->content_type_header_value)) {
       return false;
     }
   }
==== 
//depot/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.h#8
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.h     
2008-09-12 19:05:53.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/firefox/async_task_ff.h     
2008-09-12 18:36:29.000000000 +0100
@@ -124,6 +124,7 @@
   bool HttpPost(const char16 *full_url,
                 bool is_capturing,
                 const char16 *reason_header_value,
+                const char16 *content_type_header_value,
                 const char16 *if_mod_since_date,
                 const char16 *required_cookie,
                 bool disable_browser_cookies,
@@ -144,6 +145,7 @@
                        const char16 *full_url,
                        bool is_capturing,
                        const char16 *reason_header_value,
+                       const char16 *content_type_header_value,
                        const char16 *if_mod_since_date,
                        const char16 *required_cookie,
                        bool disable_browser_cookies,
==== 
//depot/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.cc#12 
- 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/ie/async_task_ie.cc 
2008-09-12 17:06:48.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/ie/async_task_ie.cc 
2008-09-12 17:07:06.000000000 +0100
@@ -207,6 +207,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         NULL,  // content_type_header_value
                          if_mod_since_date,
                          required_cookie,
                          false,
@@ -224,6 +225,7 @@
 bool AsyncTask::HttpPost(const char16 *full_url,
                          bool is_capturing,
                          const char16 *reason_header_value,
+                         const char16 *content_type_header_value,
                          const char16 *if_mod_since_date,
                          const char16 *required_cookie,
                          bool disable_browser_cookies,
@@ -237,6 +239,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         content_type_header_value,
                          if_mod_since_date,
                          required_cookie,
                          disable_browser_cookies,
@@ -255,6 +258,7 @@
                                 const char16 *full_url,
                                 bool is_capturing,
                                 const char16 *reason_header_value,
+                                const char16 *content_type_header_value,
                                 const char16 *if_mod_since_date,
                                 const char16 *required_cookie,
                                 bool disable_browser_cookies,
@@ -320,6 +324,13 @@
   if (reason_header_value && reason_header_value[0]) {
     if (!http_request->SetRequestHeader(HttpConstants::kXGearsReasonHeader,
                                         reason_header_value)) {
+      return false;
+    }
+  }
+
+  if (content_type_header_value && content_type_header_value[0]) {
+    if (!http_request->SetRequestHeader(HttpConstants::kContentTypeHeader,
+                                        content_type_header_value)) {
       return false;
     }
   }
==== 
//depot/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.h#7 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/ie/async_task_ie.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/ie/async_task_ie.h  
2008-09-12 17:06:48.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/ie/async_task_ie.h  
2008-09-12 17:07:09.000000000 +0100
@@ -115,6 +115,7 @@
   bool HttpPost(const char16 *full_url,
                 bool is_capturing,
                 const char16 *reason_header_value,
+                const char16 *content_type_header_value,
                 const char16 *if_mod_since_date,
                 const char16 *required_cookie,
                 bool disable_browser_cookies,
@@ -136,6 +137,7 @@
                        const char16 *full_url,
                        bool is_capturing,
                        const char16 *reason_header_value,
+                       const char16 *content_type_header_value,
                        const char16 *if_mod_since_date,
                        const char16 *required_cookie,
                        bool disable_browser_cookies,
==== 
//depot/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.cc#14
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/npapi/async_task_np.cc      
2008-09-12 19:05:53.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/npapi/async_task_np.cc      
2008-09-12 18:58:43.000000000 +0100
@@ -271,6 +271,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         NULL,  // content_type_header_value
                          if_mod_since_date,
                          required_cookie,
                          false,
@@ -288,6 +289,7 @@
 bool AsyncTask::HttpPost(const char16 *full_url,
                          bool is_capturing,
                          const char16 *reason_header_value,
+                         const char16 *content_type_header_value,
                          const char16 *if_mod_since_date,
                          const char16 *required_cookie,
                          bool disable_browser_cookies,
@@ -301,6 +303,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         content_type_header_value,
                          if_mod_since_date,
                          required_cookie,
                          disable_browser_cookies,
@@ -337,6 +340,7 @@
                                 const char16 *full_url,
                                 bool is_capturing,
                                 const char16 *reason_header_value,
+                                const char16 *content_type_header_value,
                                 const char16 *if_mod_since_date,
                                 const char16 *required_cookie,
                                 bool disable_browser_cookies,
@@ -403,6 +407,13 @@
   if (reason_header_value && reason_header_value[0]) {
     if (!http_request->SetRequestHeader(HttpConstants::kXGearsReasonHeader,
                                         reason_header_value)) {
+      return false;
+    }
+  }
+
+  if (content_type_header_value && content_type_header_value[0]) {
+    if (!http_request->SetRequestHeader(HttpConstants::kContentTypeHeader,
+                                        content_type_header_value)) {
       return false;
     }
   }
==== 
//depot/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.h#9 
- 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/npapi/async_task_np.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/npapi/async_task_np.h       
2008-09-12 19:05:53.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/npapi/async_task_np.h       
2008-09-12 18:40:04.000000000 +0100
@@ -139,6 +139,7 @@
   bool HttpPost(const char16 *full_url,
                 bool is_capturing,
                 const char16 *reason_header_value,
+                const char16 *content_type_header_value,
                 const char16 *if_mod_since_date,
                 const char16 *required_cookie,
                 bool disable_browser_cookies,
@@ -166,6 +167,7 @@
                        const char16 *full_url,
                        bool is_capturing,
                        const char16 *reason_header_value,
+                       const char16 *content_type_header_value,
                        const char16 *if_mod_since_date,
                        const char16 *required_cookie,
                        bool disable_browser_cookies,
==== 
//depot/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.h#6
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/safari/async_task_sf.h      
2008-09-12 19:05:53.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/safari/async_task_sf.h      
2008-09-12 18:40:21.000000000 +0100
@@ -120,6 +120,7 @@
   bool HttpPost(const char16 *full_url,
                 bool is_capturing,
                 const char16 *reason_header_value,
+                const char16 *content_type_header_value,
                 const char16 *if_mod_since_date,
                 const char16 *required_cookie,
                 bool disable_browser_cookies,
@@ -141,6 +142,7 @@
                        const char16 *full_url,
                        bool is_capturing,
                        const char16 *reason_header_value,
+                       const char16 *content_type_header_value,
                        const char16 *if_mod_since_date,
                        const char16 *required_cookie,
                        bool disable_browser_cookies,
==== 
//depot/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.mm#12
 - 
c:\MyDocs\Gears1/googleclient/gears/opensource/gears/localserver/safari/async_task_sf.mm
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/localserver/safari/async_task_sf.mm     
2008-09-12 19:05:53.000000000 +0100
+++ googleclient/gears/opensource/gears/localserver/safari/async_task_sf.mm     
2008-09-12 19:01:19.000000000 +0100
@@ -221,6 +221,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         NULL,  // content_type_header_value
                          if_mod_since_date,
                          required_cookie,
                          false,
@@ -238,6 +239,7 @@
 bool AsyncTask::HttpPost(const char16 *full_url,
                          bool is_capturing,
                          const char16 *reason_header_value,
+                         const char16 *content_type_header_value,
                          const char16 *if_mod_since_date,
                          const char16 *required_cookie,
                          bool disable_browser_cookies,
@@ -251,6 +253,7 @@
                          full_url,
                          is_capturing,
                          reason_header_value,
+                         content_type_header_value,
                          if_mod_since_date,
                          required_cookie,
                          disable_browser_cookies,
@@ -269,6 +272,7 @@
                                 const char16 *full_url,
                                 bool is_capturing,
                                 const char16 *reason_header_value,
+                                const char16 *content_type_header_value,
                                 const char16 *if_mod_since_date,
                                 const char16 *required_cookie,
                                 bool disable_browser_cookies,
@@ -340,6 +344,13 @@
     }
   }
 
+  if (content_type_header_value && content_type_header_value[0]) {
+    if (!http_request->SetRequestHeader(HttpConstants::kContentTypeHeader,
+                                        content_type_header_value)) {
+      return false;
+    }
+  }
+
   if (if_mod_since_date && if_mod_since_date[0]) {
     if (!http_request->SetRequestHeader(HttpConstants::kIfModifiedSinceHeader,
                                         if_mod_since_date)) {

Reply via email to