| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 ListValue args; | 387 ListValue args; |
| 388 | 388 |
| 389 DictionaryValue* properties = new DictionaryValue(); | 389 DictionaryValue* properties = new DictionaryValue(); |
| 390 properties->SetInteger(L"menuItemId", item->id().second); | 390 properties->SetInteger(L"menuItemId", item->id().second); |
| 391 if (item->parent_id()) | 391 if (item->parent_id()) |
| 392 properties->SetInteger(L"parentMenuItemId", item->parent_id()->second); | 392 properties->SetInteger(L"parentMenuItemId", item->parent_id()->second); |
| 393 | 393 |
| 394 switch (params.media_type) { | 394 switch (params.media_type) { |
| 395 case WebKit::WebContextMenuData::MediaTypeImage: | 395 case WebKit::WebContextMenuData::MediaTypeImage: |
| 396 properties->SetString(L"mediaType", "IMAGE"); | 396 properties->SetString(L"mediaType", "image"); |
| 397 break; | 397 break; |
| 398 case WebKit::WebContextMenuData::MediaTypeVideo: | 398 case WebKit::WebContextMenuData::MediaTypeVideo: |
| 399 properties->SetString(L"mediaType", "VIDEO"); | 399 properties->SetString(L"mediaType", "video"); |
| 400 break; | 400 break; |
| 401 case WebKit::WebContextMenuData::MediaTypeAudio: | 401 case WebKit::WebContextMenuData::MediaTypeAudio: |
| 402 properties->SetString(L"mediaType", "AUDIO"); | 402 properties->SetString(L"mediaType", "audio"); |
| 403 break; | 403 break; |
| 404 default: {} // Do nothing. | 404 default: {} // Do nothing. |
| 405 } | 405 } |
| 406 | 406 |
| 407 AddURLProperty(properties, L"linkUrl", params.unfiltered_link_url); | 407 AddURLProperty(properties, L"linkUrl", params.unfiltered_link_url); |
| 408 AddURLProperty(properties, L"srcUrl", params.src_url); | 408 AddURLProperty(properties, L"srcUrl", params.src_url); |
| 409 AddURLProperty(properties, L"mainFrameUrl", params.page_url); | 409 AddURLProperty(properties, L"pageUrl", params.page_url); |
| 410 AddURLProperty(properties, L"frameUrl", params.frame_url); | 410 AddURLProperty(properties, L"frameUrl", params.frame_url); |
| 411 | 411 |
| 412 if (params.selection_text.length() > 0) | 412 if (params.selection_text.length() > 0) |
| 413 properties->SetString(L"selectionText", params.selection_text); | 413 properties->SetString(L"selectionText", params.selection_text); |
| 414 | 414 |
| 415 properties->SetBoolean(L"editable", params.is_editable); | 415 properties->SetBoolean(L"editable", params.is_editable); |
| 416 | 416 |
| 417 args.Append(properties); | 417 args.Append(properties); |
| 418 | 418 |
| 419 // Add the tab info to the argument list. | 419 // Add the tab info to the argument list. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 const SkBitmap& ExtensionMenuManager::GetIconForExtension( | 461 const SkBitmap& ExtensionMenuManager::GetIconForExtension( |
| 462 const std::string& extension_id) { | 462 const std::string& extension_id) { |
| 463 return icon_manager_.GetIcon(extension_id); | 463 return icon_manager_.GetIcon(extension_id); |
| 464 } | 464 } |
| 465 | 465 |
| 466 // static | 466 // static |
| 467 bool ExtensionMenuManager::HasAllowedScheme(const GURL& url) { | 467 bool ExtensionMenuManager::HasAllowedScheme(const GURL& url) { |
| 468 URLPattern pattern(kAllowedSchemes); | 468 URLPattern pattern(kAllowedSchemes); |
| 469 return pattern.SetScheme(url.scheme()); | 469 return pattern.SetScheme(url.scheme()); |
| 470 } | 470 } |
| OLD | NEW |