mahdin70 commited on
Commit
b680f7b
·
verified ·
1 Parent(s): ba0824f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +28 -3
README.md CHANGED
@@ -123,9 +123,34 @@ model.eval()
123
 
124
  # Example code snippet
125
  code = """
126
- void example(char *input) {
127
- char buffer[10];
128
- strcpy(buffer, input);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
  """
131
 
 
123
 
124
  # Example code snippet
125
  code = """
126
+ bool DebuggerFunction::InitTabContents() {
127
+ Value* debuggee;
128
+ EXTENSION_FUNCTION_VALIDATE(args_->Get(0, &debuggee));
129
+
130
+ DictionaryValue* dict = static_cast<DictionaryValue*>(debuggee);
131
+ EXTENSION_FUNCTION_VALIDATE(dict->GetInteger(keys::kTabIdKey, &tab_id_));
132
+
133
+ contents_ = NULL;
134
+ TabContentsWrapper* wrapper = NULL;
135
+ bool result = ExtensionTabUtil::GetTabById(
136
+ tab_id_, profile(), include_incognito(), NULL, NULL, &wrapper, NULL);
137
+ if (!result || !wrapper) {
138
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
139
+ keys::kNoTabError,
140
+ base::IntToString(tab_id_));
141
+ return false;
142
+ }
143
+ contents_ = wrapper->web_contents();
144
+
145
+ if (ChromeWebUIControllerFactory::GetInstance()->HasWebUIScheme(
146
+ contents_->GetURL())) {
147
+ error_ = ExtensionErrorUtils::FormatErrorMessage(
148
+ keys::kAttachToWebUIError,
149
+ contents_->GetURL().scheme());
150
+ return false;
151
+ }
152
+
153
+ return true;
154
  }
155
  """
156