| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" | 5 #include "chrome/browser/bookmarks/bookmark_manager_extension_api.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 args->Append(value); | 152 args->Append(value); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace | 155 } // namespace |
| 156 | 156 |
| 157 BookmarkManagerExtensionEventRouter::BookmarkManagerExtensionEventRouter( | 157 BookmarkManagerExtensionEventRouter::BookmarkManagerExtensionEventRouter( |
| 158 Profile* profile, TabContents* tab) | 158 Profile* profile, TabContents* tab) |
| 159 : profile_(profile), | 159 : profile_(profile), |
| 160 tab_(tab) { | 160 tab_(tab) { |
| 161 tab_->bookmark_tab_helper()->SetBookmarkDragDelegate(this); | 161 BookmarkTabHelper* bookmark_tab_helper = |
| 162 BookmarkTabHelper::FromWebContents(tab_->web_contents()); |
| 163 bookmark_tab_helper->SetBookmarkDragDelegate(this); |
| 162 } | 164 } |
| 163 | 165 |
| 164 BookmarkManagerExtensionEventRouter::~BookmarkManagerExtensionEventRouter() { | 166 BookmarkManagerExtensionEventRouter::~BookmarkManagerExtensionEventRouter() { |
| 165 if (tab_->bookmark_tab_helper()->GetBookmarkDragDelegate() == this) | 167 BookmarkTabHelper* bookmark_tab_helper = |
| 166 tab_->bookmark_tab_helper()->SetBookmarkDragDelegate(NULL); | 168 BookmarkTabHelper::FromWebContents(tab_->web_contents()); |
| 169 if (bookmark_tab_helper->GetBookmarkDragDelegate() == this) |
| 170 bookmark_tab_helper->SetBookmarkDragDelegate(NULL); |
| 167 } | 171 } |
| 168 | 172 |
| 169 void BookmarkManagerExtensionEventRouter::DispatchEvent( | 173 void BookmarkManagerExtensionEventRouter::DispatchEvent( |
| 170 const char* event_name, scoped_ptr<ListValue> args) { | 174 const char* event_name, scoped_ptr<ListValue> args) { |
| 171 if (!profile_->GetExtensionEventRouter()) | 175 if (!profile_->GetExtensionEventRouter()) |
| 172 return; | 176 return; |
| 173 | 177 |
| 174 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( | 178 profile_->GetExtensionEventRouter()->DispatchEventToRenderers( |
| 175 event_name, args.Pass(), NULL, GURL(), extensions::EventFilteringInfo()); | 179 event_name, args.Pass(), NULL, GURL(), extensions::EventFilteringInfo()); |
| 176 } | 180 } |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 bool can_open_new_windows = true; | 512 bool can_open_new_windows = true; |
| 509 | 513 |
| 510 #if defined(OS_WIN) | 514 #if defined(OS_WIN) |
| 511 if (base::win::IsMetroProcess()) | 515 if (base::win::IsMetroProcess()) |
| 512 can_open_new_windows = false; | 516 can_open_new_windows = false; |
| 513 #endif // OS_WIN | 517 #endif // OS_WIN |
| 514 | 518 |
| 515 SetResult(Value::CreateBooleanValue(can_open_new_windows)); | 519 SetResult(Value::CreateBooleanValue(can_open_new_windows)); |
| 516 return true; | 520 return true; |
| 517 } | 521 } |
| OLD | NEW |