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/intents/web_intents_registry.h" | 5 #include "chrome/browser/intents/web_intents_registry.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
15 #include "chrome/browser/intents/default_web_intent_service.h" | 15 #include "chrome/browser/intents/default_web_intent_service.h" |
16 #include "chrome/browser/webdata/web_data_service.h" | 16 #include "chrome/browser/webdata/web_data_service.h" |
17 #include "chrome/common/extensions/extension.h" | 17 #include "chrome/common/extensions/extension.h" |
18 #include "chrome/common/extensions/extension_set.h" | 18 #include "chrome/common/extensions/extension_set.h" |
19 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
20 #include "net/base/mime_util.h" | 20 #include "net/base/mime_util.h" |
21 | 21 |
| 22 using extensions::Extension; |
| 23 |
22 namespace { | 24 namespace { |
23 | 25 |
24 typedef WebIntentsRegistry::IntentServiceList IntentServiceList; | 26 typedef WebIntentsRegistry::IntentServiceList IntentServiceList; |
25 | 27 |
26 // Compares two mime types for equality. Supports wild cards in both | 28 // Compares two mime types for equality. Supports wild cards in both |
27 // |type1| and |type2|. Wild cards are of the form '<type>/*' or '*'. | 29 // |type1| and |type2|. Wild cards are of the form '<type>/*' or '*'. |
28 bool MimeTypesAreEqual(const string16& type1, const string16& type2) { | 30 bool MimeTypesAreEqual(const string16& type1, const string16& type2) { |
29 // We don't have a MIME matcher that allows patterns on both sides | 31 // We don't have a MIME matcher that allows patterns on both sides |
30 // Instead, we do two comparisons, treating each type in turn as a | 32 // Instead, we do two comparisons, treating each type in turn as a |
31 // pattern. If either one matches, we consider this a MIME match. | 33 // pattern. If either one matches, we consider this a MIME match. |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 if (write_iter != read_iter) | 449 if (write_iter != read_iter) |
448 *write_iter = *read_iter; | 450 *write_iter = *read_iter; |
449 } | 451 } |
450 ++read_iter; | 452 ++read_iter; |
451 } | 453 } |
452 | 454 |
453 // Cut off everything after the last intent copied to the list. | 455 // Cut off everything after the last intent copied to the list. |
454 if (++write_iter != services->end()) | 456 if (++write_iter != services->end()) |
455 services->erase(write_iter, services->end()); | 457 services->erase(write_iter, services->end()); |
456 } | 458 } |
OLD | NEW |