Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1198)

Side by Side Diff: chrome/browser/extensions/api/debugger/debugger_api.cc

Issue 11748012: Minor cleanup to how infobars handle expiry: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // Implements the Chrome Extensions Debugger API. 5 // Implements the Chrome Extensions Debugger API.
6 6
7 #include "chrome/browser/extensions/api/debugger/debugger_api.h" 7 #include "chrome/browser/extensions/api/debugger/debugger_api.h"
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 const std::string& client_name, 64 const std::string& client_name,
65 ExtensionDevToolsClientHost* client_host); 65 ExtensionDevToolsClientHost* client_host);
66 virtual ~ExtensionDevToolsInfoBarDelegate(); 66 virtual ~ExtensionDevToolsInfoBarDelegate();
67 67
68 // Notifies infobar delegate that associated DevToolsClientHost will be 68 // Notifies infobar delegate that associated DevToolsClientHost will be
69 // destroyed. 69 // destroyed.
70 void DiscardClientHost(); 70 void DiscardClientHost();
71 71
72 private: 72 private:
73 // ConfirmInfoBarDelegate: 73 // ConfirmInfoBarDelegate:
74 virtual bool ShouldExpire(
75 const content::LoadCommittedDetails& details) const OVERRIDE;
76 virtual int GetButtons() const OVERRIDE; 74 virtual int GetButtons() const OVERRIDE;
77 virtual Type GetInfoBarType() const OVERRIDE; 75 virtual Type GetInfoBarType() const OVERRIDE;
76 virtual bool ShouldExpireInternal(
77 const content::LoadCommittedDetails& details) const OVERRIDE;
78 virtual string16 GetMessageText() const OVERRIDE; 78 virtual string16 GetMessageText() const OVERRIDE;
79 virtual void InfoBarDismissed() OVERRIDE; 79 virtual void InfoBarDismissed() OVERRIDE;
80 virtual bool Cancel() OVERRIDE; 80 virtual bool Cancel() OVERRIDE;
81 81
82 std::string client_name_; 82 std::string client_name_;
83 ExtensionDevToolsClientHost* client_host_; 83 ExtensionDevToolsClientHost* client_host_;
84 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsInfoBarDelegate); 84 DISALLOW_COPY_AND_ASSIGN(ExtensionDevToolsInfoBarDelegate);
85 }; 85 };
86 86
87 class ExtensionDevToolsClientHost : public DevToolsClientHost, 87 class ExtensionDevToolsClientHost : public DevToolsClientHost,
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 client_host_(client_host) { 356 client_host_(client_host) {
357 } 357 }
358 358
359 ExtensionDevToolsInfoBarDelegate::~ExtensionDevToolsInfoBarDelegate() { 359 ExtensionDevToolsInfoBarDelegate::~ExtensionDevToolsInfoBarDelegate() {
360 } 360 }
361 361
362 void ExtensionDevToolsInfoBarDelegate::DiscardClientHost() { 362 void ExtensionDevToolsInfoBarDelegate::DiscardClientHost() {
363 client_host_ = NULL; 363 client_host_ = NULL;
364 } 364 }
365 365
366 bool ExtensionDevToolsInfoBarDelegate::ShouldExpire(
367 const content::LoadCommittedDetails& details) const {
368 return false;
369 }
370
371 int ExtensionDevToolsInfoBarDelegate::GetButtons() const { 366 int ExtensionDevToolsInfoBarDelegate::GetButtons() const {
372 return BUTTON_CANCEL; 367 return BUTTON_CANCEL;
373 } 368 }
374 369
375 InfoBarDelegate::Type ExtensionDevToolsInfoBarDelegate::GetInfoBarType() const { 370 InfoBarDelegate::Type ExtensionDevToolsInfoBarDelegate::GetInfoBarType() const {
376 return WARNING_TYPE; 371 return WARNING_TYPE;
377 } 372 }
378 373
374 bool ExtensionDevToolsInfoBarDelegate::ShouldExpireInternal(
375 const content::LoadCommittedDetails& details) const {
376 return false;
377 }
378
379 string16 ExtensionDevToolsInfoBarDelegate::GetMessageText() const { 379 string16 ExtensionDevToolsInfoBarDelegate::GetMessageText() const {
380 return l10n_util::GetStringFUTF16(IDS_DEV_TOOLS_INFOBAR_LABEL, 380 return l10n_util::GetStringFUTF16(IDS_DEV_TOOLS_INFOBAR_LABEL,
381 UTF8ToUTF16(client_name_)); 381 UTF8ToUTF16(client_name_));
382 } 382 }
383 383
384 void ExtensionDevToolsInfoBarDelegate::InfoBarDismissed() { 384 void ExtensionDevToolsInfoBarDelegate::InfoBarDismissed() {
385 if (client_host_) 385 if (client_host_)
386 client_host_->MarkAsDismissed(); 386 client_host_->MarkAsDismissed();
387 } 387 }
388 388
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 525 }
526 526
527 DictionaryValue* result_body; 527 DictionaryValue* result_body;
528 SendCommand::Results::Result result; 528 SendCommand::Results::Result result;
529 if (response->GetDictionary("result", &result_body)) 529 if (response->GetDictionary("result", &result_body))
530 result.additional_properties.Swap(result_body); 530 result.additional_properties.Swap(result_body);
531 531
532 results_ = SendCommand::Results::Create(result); 532 results_ = SendCommand::Results::Create(result);
533 SendResponse(true); 533 SendResponse(true);
534 } 534 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698