Refactored code by removing extra check for vector size in SendAppControlEvent function. 64/179864/3
authordeepti <d.saraswat@samsung.com>
Wed, 23 May 2018 05:24:04 +0000 (10:54 +0530)
committerdeepti <d.saraswat@samsung.com>
Wed, 23 May 2018 09:47:45 +0000 (15:17 +0530)
Removed extra header files and made proper indent.

Change-Id: I21281e5009e9c5c3ed7d404f9a0ced7a4c273a7b
Signed-off-by: deepti <d.saraswat@samsung.com>
atom/browser/browser.cc

index 9efce42..7e87db2 100644 (file)
@@ -14,9 +14,7 @@
 #include "base/files/file_util.h"
 #include "base/path_service.h"
 #include "base/run_loop.h"
-#include "base/strings/string16.h"
 #include "base/strings/utf_string_conversions.h"
-#include "base/values.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "brightray/browser/brightray_paths.h"
 #include "content/public/browser/render_frame_host.h"
@@ -292,37 +290,33 @@ void Browser::AppControl(std::unique_ptr<common::AppControl> appcontrol) {
   std::unique_ptr<common::ResourceManager::Resource> res =
       resource_manager_->GetStartResource(appcontrol.get());
   bool do_reset = res->should_reset();
-  NativeWindow *last_window= WindowList::GetLastWindow();
+  NativeWindow *last_window = WindowList::GetLastWindow();
   std::string localized_page = res->uri();
-  if(!do_reset)
-  {
-  std::string current_page=last_window->web_contents()->GetURL().spec();
-  if (current_page != localized_page) {
-    do_reset = true;
-  } else {
-    SendAppControlEvent();
-  }
-  }
+  if (!do_reset) {
+    std::string current_page = last_window->web_contents()->GetURL().spec();
+    if (current_page != localized_page)
+      do_reset = true;
+    else
+      SendAppControlEvent();
+    }
   if (do_reset && (appcontrol->operation() == kAppControlMain)) {
     do_reset = false;
     SendAppControlEvent();
   }
-  if (do_reset) {
-     //To do :Implementation of ClearViewStack(), SetupWebWindow(),SetupWebWindowCompatibilitySettings() function
-  }
+  if (do_reset)
+    //To do :Implementation of ClearViewStack(), SetupWebWindow(),SetupWebWindowCompatibilitySettings() function
 }
 
 void Browser::SendAppControlEvent() {
-  std::vector<NativeWindow*> WindowVector;
-  WindowVector=WindowList::GetWindows();
-  NativeWindow *last_window= WindowList::GetLastWindow();
-  if (WindowVector.size() > 0 && last_window != NULL) {
-      content::RenderFrameHost* rfh = last_window->web_contents()->GetMainFrame();
-  if (rfh) {
+  NativeWindow *last_window = WindowList::GetLastWindow();
+
+  if (last_window != NULL) {
+    content::RenderFrameHost* rfh = last_window->web_contents()->GetMainFrame();
+    if (rfh) {
       rfh->ExecuteJavaScriptWithUserGestureForTests(
-      base::UTF8ToUTF16(kAppControlEventScript));
+        base::UTF8ToUTF16(kAppControlEventScript));
     }
-   }
+  }
 }
 
 void Browser::Launch(std::unique_ptr<common::AppControl> appcontrol) {