OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 checked_ = checked; | 85 checked_ = checked; |
86 return true; | 86 return true; |
87 } | 87 } |
88 | 88 |
89 void ExtensionMenuItem::AddChild(ExtensionMenuItem* item) { | 89 void ExtensionMenuItem::AddChild(ExtensionMenuItem* item) { |
90 item->parent_id_.reset(new Id(id_)); | 90 item->parent_id_.reset(new Id(id_)); |
91 children_.push_back(item); | 91 children_.push_back(item); |
92 } | 92 } |
93 | 93 |
94 const int ExtensionMenuManager::kAllowedSchemes = | 94 const int ExtensionMenuManager::kAllowedSchemes = |
95 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS; | 95 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | |
| 96 URLPattern::SCHEME_FILESYSTEM; |
96 | 97 |
97 ExtensionMenuManager::ExtensionMenuManager() { | 98 ExtensionMenuManager::ExtensionMenuManager() { |
98 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 99 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
99 NotificationService::AllSources()); | 100 NotificationService::AllSources()); |
100 } | 101 } |
101 | 102 |
102 ExtensionMenuManager::~ExtensionMenuManager() { | 103 ExtensionMenuManager::~ExtensionMenuManager() { |
103 MenuItemMap::iterator i; | 104 MenuItemMap::iterator i; |
104 for (i = context_items_.begin(); i != context_items_.end(); ++i) { | 105 for (i = context_items_.begin(); i != context_items_.end(); ++i) { |
105 STLDeleteElements(&(i->second)); | 106 STLDeleteElements(&(i->second)); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 switch (params.media_type) { | 398 switch (params.media_type) { |
398 case WebKit::WebContextMenuData::MediaTypeImage: | 399 case WebKit::WebContextMenuData::MediaTypeImage: |
399 properties->SetString("mediaType", "image"); | 400 properties->SetString("mediaType", "image"); |
400 break; | 401 break; |
401 case WebKit::WebContextMenuData::MediaTypeVideo: | 402 case WebKit::WebContextMenuData::MediaTypeVideo: |
402 properties->SetString("mediaType", "video"); | 403 properties->SetString("mediaType", "video"); |
403 break; | 404 break; |
404 case WebKit::WebContextMenuData::MediaTypeAudio: | 405 case WebKit::WebContextMenuData::MediaTypeAudio: |
405 properties->SetString("mediaType", "audio"); | 406 properties->SetString("mediaType", "audio"); |
406 break; | 407 break; |
| 408 case WebKit::WebContextMenuData::MediaTypeFile: |
| 409 properties->SetString("mediaType", "file"); |
| 410 break; |
407 default: {} // Do nothing. | 411 default: {} // Do nothing. |
408 } | 412 } |
409 | 413 |
410 AddURLProperty(properties, "linkUrl", params.unfiltered_link_url); | 414 AddURLProperty(properties, "linkUrl", params.unfiltered_link_url); |
411 AddURLProperty(properties, "srcUrl", params.src_url); | 415 AddURLProperty(properties, "srcUrl", params.src_url); |
412 AddURLProperty(properties, "pageUrl", params.page_url); | 416 AddURLProperty(properties, "pageUrl", params.page_url); |
413 AddURLProperty(properties, "frameUrl", params.frame_url); | 417 AddURLProperty(properties, "frameUrl", params.frame_url); |
414 | 418 |
415 if (params.selection_text.length() > 0) | 419 if (params.selection_text.length() > 0) |
416 properties->SetString("selectionText", params.selection_text); | 420 properties->SetString("selectionText", params.selection_text); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 if (profile < other.profile) | 502 if (profile < other.profile) |
499 return true; | 503 return true; |
500 if (profile == other.profile) { | 504 if (profile == other.profile) { |
501 if (extension_id < other.extension_id) | 505 if (extension_id < other.extension_id) |
502 return true; | 506 return true; |
503 if (extension_id == other.extension_id) | 507 if (extension_id == other.extension_id) |
504 return uid < other.uid; | 508 return uid < other.uid; |
505 } | 509 } |
506 return false; | 510 return false; |
507 } | 511 } |
OLD | NEW |