| 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/extensions/extension_menu_manager.h" | 5 #include "chrome/browser/extensions/extension_menu_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/extensions/extension_event_router.h" | 15 #include "chrome/browser/extensions/extension_event_router.h" |
| 16 #include "chrome/browser/extensions/extension_tab_util.h" | 16 #include "chrome/browser/extensions/extension_tab_util.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 19 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 20 #include "content/public/browser/notification_details.h" | 20 #include "content/public/browser/notification_details.h" |
| 21 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
| 22 #include "content/public/common/context_menu_params.h" |
| 22 #include "ui/base/text/text_elider.h" | 23 #include "ui/base/text/text_elider.h" |
| 23 #include "ui/gfx/favicon_size.h" | 24 #include "ui/gfx/favicon_size.h" |
| 24 #include "webkit/glue/context_menu.h" | |
| 25 | 25 |
| 26 using content::WebContents; | 26 using content::WebContents; |
| 27 | 27 |
| 28 ExtensionMenuItem::ExtensionMenuItem(const Id& id, | 28 ExtensionMenuItem::ExtensionMenuItem(const Id& id, |
| 29 const std::string& title, | 29 const std::string& title, |
| 30 bool checked, | 30 bool checked, |
| 31 Type type, | 31 Type type, |
| 32 const ContextList& contexts) | 32 const ContextList& contexts) |
| 33 : id_(id), | 33 : id_(id), |
| 34 title_(title), | 34 title_(title), |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 383 |
| 384 static void AddURLProperty(DictionaryValue* dictionary, | 384 static void AddURLProperty(DictionaryValue* dictionary, |
| 385 const std::string& key, const GURL& url) { | 385 const std::string& key, const GURL& url) { |
| 386 if (!url.is_empty()) | 386 if (!url.is_empty()) |
| 387 dictionary->SetString(key, url.possibly_invalid_spec()); | 387 dictionary->SetString(key, url.possibly_invalid_spec()); |
| 388 } | 388 } |
| 389 | 389 |
| 390 void ExtensionMenuManager::ExecuteCommand( | 390 void ExtensionMenuManager::ExecuteCommand( |
| 391 Profile* profile, | 391 Profile* profile, |
| 392 WebContents* web_contents, | 392 WebContents* web_contents, |
| 393 const ContextMenuParams& params, | 393 const content::ContextMenuParams& params, |
| 394 const ExtensionMenuItem::Id& menuItemId) { | 394 const ExtensionMenuItem::Id& menuItemId) { |
| 395 ExtensionEventRouter* event_router = profile->GetExtensionEventRouter(); | 395 ExtensionEventRouter* event_router = profile->GetExtensionEventRouter(); |
| 396 if (!event_router) | 396 if (!event_router) |
| 397 return; | 397 return; |
| 398 | 398 |
| 399 ExtensionMenuItem* item = GetItemById(menuItemId); | 399 ExtensionMenuItem* item = GetItemById(menuItemId); |
| 400 if (!item) | 400 if (!item) |
| 401 return; | 401 return; |
| 402 | 402 |
| 403 if (item->type() == ExtensionMenuItem::RADIO) | 403 if (item->type() == ExtensionMenuItem::RADIO) |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (profile < other.profile) | 566 if (profile < other.profile) |
| 567 return true; | 567 return true; |
| 568 if (profile == other.profile) { | 568 if (profile == other.profile) { |
| 569 if (extension_id < other.extension_id) | 569 if (extension_id < other.extension_id) |
| 570 return true; | 570 return true; |
| 571 if (extension_id == other.extension_id) | 571 if (extension_id == other.extension_id) |
| 572 return uid < other.uid; | 572 return uid < other.uid; |
| 573 } | 573 } |
| 574 return false; | 574 return false; |
| 575 } | 575 } |
| OLD | NEW |