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 #ifndef CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
6 #define CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 6 #define CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 // Embedder API (or SPI) for participating in browser logic, to be implemented | 76 // Embedder API (or SPI) for participating in browser logic, to be implemented |
77 // by the client of the content browser. See ChromeContentBrowserClient for the | 77 // by the client of the content browser. See ChromeContentBrowserClient for the |
78 // principal implementation. The methods are assumed to be called on the UI | 78 // principal implementation. The methods are assumed to be called on the UI |
79 // thread unless otherwise specified. Use this "escape hatch" sparingly, to | 79 // thread unless otherwise specified. Use this "escape hatch" sparingly, to |
80 // avoid the embedder interface ballooning and becoming very specific to Chrome. | 80 // avoid the embedder interface ballooning and becoming very specific to Chrome. |
81 // (Often, the call out to the client can happen in a different part of the code | 81 // (Often, the call out to the client can happen in a different part of the code |
82 // that either already has a hook out to the embedder, or calls out to one of | 82 // that either already has a hook out to the embedder, or calls out to one of |
83 // the observer interfaces.) | 83 // the observer interfaces.) |
84 class CONTENT_EXPORT ContentBrowserClient { | 84 class CONTENT_EXPORT ContentBrowserClient { |
85 public: | 85 public: |
86 struct SocketPermissionParam { | |
87 enum OperationType { | |
88 NONE = 0, | |
89 TCP_CONNECT, | |
90 TCP_LISTEN, | |
91 UDP_BIND, | |
92 UDP_SEND_TO, | |
93 }; | |
94 | |
95 SocketPermissionParam(OperationType type, | |
96 const std::string& host, | |
97 int port) | |
98 : type(type), | |
99 host(host), | |
100 port(port) { | |
101 } | |
102 | |
103 OperationType type; | |
104 std::string host; | |
105 int port; | |
ygorshenin1
2012/09/28 14:43:34
s/int/uint16_t?
Dmitry Polukhin
2012/10/01 11:00:24
Not sure. Port is declared as int in many other pl
| |
106 }; | |
107 | |
86 virtual ~ContentBrowserClient() {} | 108 virtual ~ContentBrowserClient() {} |
87 | 109 |
88 // Allows the embedder to set any number of custom BrowserMainParts | 110 // Allows the embedder to set any number of custom BrowserMainParts |
89 // implementations for the browser startup code. See comments in | 111 // implementations for the browser startup code. See comments in |
90 // browser_main_parts.h. | 112 // browser_main_parts.h. |
91 virtual BrowserMainParts* CreateBrowserMainParts( | 113 virtual BrowserMainParts* CreateBrowserMainParts( |
92 const MainFunctionParams& parameters); | 114 const MainFunctionParams& parameters); |
93 | 115 |
94 // Allows an embedder to return their own WebContentsView implementation. | 116 // Allows an embedder to return their own WebContentsView implementation. |
95 // Return NULL to let the default one for the platform be created. Otherwise | 117 // Return NULL to let the default one for the platform be created. Otherwise |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
435 // Returns the default filename used in downloads when we have no idea what | 457 // Returns the default filename used in downloads when we have no idea what |
436 // else we should do with the file. | 458 // else we should do with the file. |
437 virtual std::string GetDefaultDownloadName(); | 459 virtual std::string GetDefaultDownloadName(); |
438 | 460 |
439 // Notifification that a pepper plugin has just been spawned. This allows the | 461 // Notifification that a pepper plugin has just been spawned. This allows the |
440 // embedder to add filters onto the host to implement interfaces. | 462 // embedder to add filters onto the host to implement interfaces. |
441 // This is called on the IO thread. | 463 // This is called on the IO thread. |
442 virtual void DidCreatePpapiPlugin(BrowserPpapiHost* browser_host) {} | 464 virtual void DidCreatePpapiPlugin(BrowserPpapiHost* browser_host) {} |
443 | 465 |
444 // Returns true if renderer processes can use Pepper TCP/UDP sockets from | 466 // Returns true if renderer processes can use Pepper TCP/UDP sockets from |
445 // the given origin. | 467 // the given origin and connection type. |
446 virtual bool AllowPepperSocketAPI(BrowserContext* browser_context, | 468 virtual bool AllowPepperSocketAPI(BrowserContext* browser_context, |
447 const GURL& url); | 469 const GURL& url, |
470 const SocketPermissionParam& params); | |
448 | 471 |
449 // Returns true if renderer processes can use private Pepper File APIs. | 472 // Returns true if renderer processes can use private Pepper File APIs. |
450 virtual bool AllowPepperPrivateFileAPI(); | 473 virtual bool AllowPepperPrivateFileAPI(); |
451 | 474 |
452 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 475 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
453 // Populates |mappings| with all files that need to be mapped before launching | 476 // Populates |mappings| with all files that need to be mapped before launching |
454 // a child process. | 477 // a child process. |
455 virtual void GetAdditionalMappedFilesForChildProcess( | 478 virtual void GetAdditionalMappedFilesForChildProcess( |
456 const CommandLine& command_line, | 479 const CommandLine& command_line, |
457 std::vector<FileDescriptorInfo>* mappings) {} | 480 std::vector<FileDescriptorInfo>* mappings) {} |
458 #endif | 481 #endif |
459 | 482 |
460 #if defined(OS_WIN) | 483 #if defined(OS_WIN) |
461 // Returns the name of the dll that contains cursors and other resources. | 484 // Returns the name of the dll that contains cursors and other resources. |
462 virtual const wchar_t* GetResourceDllName(); | 485 virtual const wchar_t* GetResourceDllName(); |
463 #endif | 486 #endif |
464 | 487 |
465 #if defined(USE_NSS) | 488 #if defined(USE_NSS) |
466 // Return a delegate to authenticate and unlock |module|. | 489 // Return a delegate to authenticate and unlock |module|. |
467 // This is called on a worker thread. | 490 // This is called on a worker thread. |
468 virtual | 491 virtual |
469 crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( | 492 crypto::CryptoModuleBlockingPasswordDelegate* GetCryptoPasswordDelegate( |
470 const GURL& url); | 493 const GURL& url); |
471 #endif | 494 #endif |
472 }; | 495 }; |
473 | 496 |
474 } // namespace content | 497 } // namespace content |
475 | 498 |
476 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ | 499 #endif // CONTENT_PUBLIC_BROWSER_CONTENT_BROWSER_CLIENT_H_ |
OLD | NEW |