Hello noel, dsymonds,

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

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

to review the following code:

Change 9182887 by [EMAIL PROTECTED] on 2008/11/27 19:32:29 *pending*

        Make desktop.getDragAndDropData be idempotent, on Safari, just like it 
is
        on other browsers.
        
        Also fix typo/bug where a string* was being coerced into a bool.
        
        PRESUBMIT=passed
        R=noel,dsymonds
        [EMAIL PROTECTED]
        DELTA=22  (3 added, 5 deleted, 14 changed)
        OCL=9182887

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h#2 
edit
... 
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm#2 
edit
... //depot/googleclient/gears/opensource/gears/desktop/drop_target_sf.cc#3 edit

22 delta lines: 3 added, 5 deleted, 14 changed

Also consider running:
        g4 lint -c 9182887

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 9182887 by [EMAIL PROTECTED] on 2008/11/27 19:32:29 *pending*

        Make desktop.getDragAndDropData be idempotent, on Safari, just like it 
is
        on other browsers.
        
        Also fix typo/bug where a string* was being coerced into a bool.

Affected files ...

... 
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h#2 
edit
... 
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm#2 
edit
... //depot/googleclient/gears/opensource/gears/desktop/drop_target_sf.cc#3 edit

==== 
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h#2 
- 
/Users/nigeltao/devel/srcmacgears1/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h        
2008-11-27 17:17:46.000000000 +1100
+++ googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.h        
2008-11-27 14:37:16.000000000 +1100
@@ -51,7 +51,7 @@
 
 bool GetDroppedFiles(ModuleEnvironment *module_environment,
                      JsArray *files_out,
-                     bool reset);
+                     std::string16 *error_out);
 
 // These two are mutually exclusive (although they may be both false) -
 // "in a drag" means dragenter, dragover or dragleave, but not drop.
==== 
//depot/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm#2 
- 
/Users/nigeltao/devel/srcmacgears1/googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm       
2008-11-27 17:17:46.000000000 +1100
+++ googleclient/gears/opensource/gears/desktop/drag_and_drop_utils_sf.mm       
2008-11-27 15:02:24.000000000 +1100
@@ -36,15 +36,15 @@
 #import "gears/desktop/file_dialog.h"
 
 static std::vector<std::string16> g_dragging_pasteboard_filenames_;
-static bool g_is_in_a_drag_operation_ = false;
-static bool g_is_in_a_drop_operation_ = false;
+static bool g_is_in_a_drag_operation = false;
+static bool g_is_in_a_drop_operation = false;
 
 bool IsInADragOperation() {
-  return g_is_in_a_drag_operation_;
+  return g_is_in_a_drag_operation;
 }
 
 bool IsInADropOperation() {
-  return g_is_in_a_drop_operation_;
+  return g_is_in_a_drop_operation;
 }
 
 // We "swizzle" some Cocoa method implementations to insert a little code
@@ -83,7 +83,7 @@
 @implementation WebView (GearsSwizzledMethods)
 
 - (NSDragOperation)swizzledDraggingEntered:(id <NSDraggingInfo>)draggingInfo {
-  g_dragging_pasteboard_filenames_.clear();
+  assert(g_dragging_pasteboard_filenames_.empty());
 
   // In Safari, arbitrary web pages can put on the pasteboard during an ondrag
   // event, simply by calling window.event.dataTransfer.setData('URL',
@@ -119,9 +119,9 @@
 }
 
 - (NSDragOperation)swizzledDraggingUpdated:(id <NSDraggingInfo>)draggingInfo {
-  g_is_in_a_drag_operation_ = true;
+  g_is_in_a_drag_operation = true;
   NSDragOperation result = [self swizzledDraggingUpdated:draggingInfo];
-  g_is_in_a_drag_operation_ = false;
+  g_is_in_a_drag_operation = false;
   return result;
 }
 
@@ -131,9 +131,10 @@
 }
 
 - (BOOL)swizzledPerformDragOperation:(id <NSDraggingInfo>)draggingInfo {
-  g_is_in_a_drop_operation_ = true;
+  g_is_in_a_drop_operation = true;
   BOOL result = [self swizzledPerformDragOperation:draggingInfo];
-  g_is_in_a_drop_operation_ = false;
+  g_dragging_pasteboard_filenames_.clear();
+  g_is_in_a_drop_operation = false;
   return result;
 }
 
@@ -160,17 +161,12 @@
 
 bool GetDroppedFiles(ModuleEnvironment *module_environment,
                      JsArray *files_out,
-                     bool reset) {
-  std::string16 ignored;
-  bool result = FileDialog::FilesToJsObjectArray(
+                     std::string16 *error_out) {
+  return FileDialog::FilesToJsObjectArray(
       g_dragging_pasteboard_filenames_,
       module_environment,
       files_out,
-      &ignored);
-  if (reset) {
-    g_dragging_pasteboard_filenames_.clear();
-  }
-  return result;
+      error_out);
 };
 
 void GetDragAndDropData(ModuleEnvironment *module_environment,
==== //depot/googleclient/gears/opensource/gears/desktop/drop_target_sf.cc#3 - 
/Users/nigeltao/devel/srcmacgears1/googleclient/gears/opensource/gears/desktop/drop_target_sf.cc
 ====
# action=edit type=text
--- googleclient/gears/opensource/gears/desktop/drop_target_sf.cc       
2008-11-27 17:17:46.000000000 +1100
+++ googleclient/gears/opensource/gears/desktop/drop_target_sf.cc       
2008-11-27 14:38:11.000000000 +1100
@@ -223,7 +223,9 @@
   if (type == HTML_EVENT_TYPE_DROP) {
     scoped_ptr<JsArray> file_array(
         module_environment_->js_runner_->NewArray());
-    if (GetDroppedFiles(module_environment_.get(), file_array.get(), true)) {
+    std::string16 ignored;
+    if (GetDroppedFiles(module_environment_.get(), file_array.get(),
+                        &ignored)) {
       context_object->SetPropertyArray(STRING16(L"files"), file_array.get());
     }
   }

Reply via email to