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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 switch (params.media_type) { | 399 switch (params.media_type) { |
399 case WebKit::WebContextMenuData::MediaTypeImage: | 400 case WebKit::WebContextMenuData::MediaTypeImage: |
400 properties->SetString("mediaType", "image"); | 401 properties->SetString("mediaType", "image"); |
401 break; | 402 break; |
402 case WebKit::WebContextMenuData::MediaTypeVideo: | 403 case WebKit::WebContextMenuData::MediaTypeVideo: |
403 properties->SetString("mediaType", "video"); | 404 properties->SetString("mediaType", "video"); |
404 break; | 405 break; |
405 case WebKit::WebContextMenuData::MediaTypeAudio: | 406 case WebKit::WebContextMenuData::MediaTypeAudio: |
406 properties->SetString("mediaType", "audio"); | 407 properties->SetString("mediaType", "audio"); |
407 break; | 408 break; |
| 409 case WebKit::WebContextMenuData::MediaTypeFile: |
| 410 properties->SetString("mediaType", "file"); |
| 411 break; |
408 default: {} // Do nothing. | 412 default: {} // Do nothing. |
409 } | 413 } |
410 | 414 |
411 AddURLProperty(properties, "linkUrl", params.unfiltered_link_url); | 415 AddURLProperty(properties, "linkUrl", params.unfiltered_link_url); |
412 AddURLProperty(properties, "srcUrl", params.src_url); | 416 AddURLProperty(properties, "srcUrl", params.src_url); |
413 AddURLProperty(properties, "pageUrl", params.page_url); | 417 AddURLProperty(properties, "pageUrl", params.page_url); |
414 AddURLProperty(properties, "frameUrl", params.frame_url); | 418 AddURLProperty(properties, "frameUrl", params.frame_url); |
415 | 419 |
416 if (params.selection_text.length() > 0) | 420 if (params.selection_text.length() > 0) |
417 properties->SetString("selectionText", params.selection_text); | 421 properties->SetString("selectionText", params.selection_text); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 if (profile < other.profile) | 505 if (profile < other.profile) |
502 return true; | 506 return true; |
503 if (profile == other.profile) { | 507 if (profile == other.profile) { |
504 if (extension_id < other.extension_id) | 508 if (extension_id < other.extension_id) |
505 return true; | 509 return true; |
506 if (extension_id == other.extension_id) | 510 if (extension_id == other.extension_id) |
507 return uid < other.uid; | 511 return uid < other.uid; |
508 } | 512 } |
509 return false; | 513 return false; |
510 } | 514 } |
OLD | NEW |